Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
Select
Case
When
(Select Count(ID) From TaskAssignment where BookCode='CCITAY09' and Section='w01')
 =
(Select Count(ID) From TaskAssignment where BookCode='CCITAY09' and Section='w01' and Status='Completed')
then
Begin
    Select Max(EndTime) EndTime From
    (
    Select EndTime From AssignedTaskReporting where BookID in
    ( Select ID From TaskAssignment where BookCode='CCITAY09' and Section='w01' )
    and EndTime !='N/A'
    union all
    Select EndTime from WLATaskAssignment where BookID='CCITAY09' and Section='w01' and Status='Completed'
    )v
End
else
'hlkljhlj'
--begin
--'' EndTime
End
Posted
Comments
OriginalGriff 19-Jul-10 7:07am    
And your question is?
WoutL 19-Jul-10 7:10am    
You forgot to ask a question.

1 solution

Add a IF Statement before the condition
like

SQL
if (Select
Case
When
(Select Count(ID) From TaskAssignment where BookCode='CCITAY09' and Section='w01'))
 =
(Select Count(ID) From TaskAssignment where BookCode='CCITAY09' and Section='w01' and Status='Completed')

Begin
    Select Max(EndTime) EndTime From
    (
    Select EndTime From AssignedTaskReporting where BookID in
    ( Select ID From TaskAssignment where BookCode='CCITAY09' and Section='w01' )
    and EndTime !='N/A'
    union all
    Select EndTime from WLATaskAssignment where BookID='CCITAY09' and Section='w01' and Status='Completed'
    )v
End
else
'hlkljhlj'
--begin
--'' EndTimeEnd
END
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900