Skip to content Skip to sidebar Skip to footer

How Do I Put A Condition In The Select Statement In T-sql

A carer can provide support to two different service at the same Start time and End time this is called 1:2 Service type. The unique ID for this type of shift type are generated as

Solution 1:

You can try something along these lines:

SELECTCaseRow_Number() OVER (PartitionBy SS.Schedule_Subshift_ID OrderBy ClientName) 
   when1then S.Schedule_Subshift_ID
   when2then S.Schedule_Subshift_ID +' 2'endFROM Subshift

You can partition by service id and order by time for example, I don't exactly understand your case. Please keep in mind that the Query you copied DOES NOT result in the result sets below. So if you want me to be more specific - please provide the proper query.

Post a Comment for "How Do I Put A Condition In The Select Statement In T-sql"