Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2014-03-28 : 04:23:59
|
please suggests smaller version of following query.I have myself done but not able to recallif( @id = 0 ) begin select Count(*) from [dbo].[event_attendee] where email = @email and eventid = @eventid and coordinatorid = @coordinatorid End else begin select Count(*) from [dbo].[event_attendee] where email = @email and ( id <> @id ) and eventid = @eventid and coordinatorid = @coordinatorid endKamran ShahidPrinciple Engineer Development(MCSD.Net,MCPD.net) |
|
MuralikrishnaVeera
Posting Yak Master
129 Posts |
Posted - 2014-03-28 : 04:35:43
|
SELECT CASE WHEN ID<>@id THEN COUNT(*) WHEN @Id =0 THEN COUNT(*) END FROM [dbo].[event_attendee] WHERE email = @email AND eventid = @Eventid AND Coordinateorid = @coordinatorId---------------Murali KrishnaYou live only once ..If you do it right once is enough....... |
|
|
|
|
|