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 |
|
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2008-09-10 : 09:19:45
|
| Here's my sp: SELECT e.EventCode, e.EventName, eg.EventGroupCode, e.shorteventname, c.content_id as SmartFormID FROM EventCode e INNER JOIN EventGroupToEventCode eg ON e.EventCode = eg.EventCode INNER JOIN content c ON c.last_edit_comment = e.EventCode WHERE eg.EventGroupCode = @EventGroupCode AND c.folder_id <> @folderIdIh AND c.folder_id <> @folderIdOl AND c.folder_id <> @folderIdOld AND c.folder_id <> @folderIdGrp Order By e.EventNameNow, if I run the sp with these params:'LES', 632, 634, 638, 554, 640I get a duplicate becasuse I now need it to ignore this folder:@iFolderCertGrp if the @EventGroupCode = 'LES'Or need to add somehow AND c.folder_id <> @iFolderCertGrp if @EventGroupCode = 'LES'Sure, I and do a long if then but I know there's and easier way.Been messing around with it but no luck so far.Suggestions?Thanks,Zath |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-10 : 09:22:53
|
[code]SELECT e.EventCode, e.EventName, eg.EventGroupCode, e.shorteventname, c.content_id AS SmartFormIDFROM EventCode AS eINNER JOIN EventGroupToEventCode AS eg ON eg.EventCode = e.EventCodeINNER JOIN Content AS c ON c.last_edit_comment = e.EventCodeWHERE eg.EventGroupCode = @EventGroupCode AND c.folder_id NOT IN (@folderIdIh, @folderIdOl, @folderIdOld, @folderIdGrp) AND (c.folder_id <> @iFolderCertGrp AND @EventGroupCode = 'LES' OR @EventGroupCode <> 'LES')ORDER BY e.EventName[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2008-09-10 : 09:32:43
|
| Peso, once again you know your stuff.I'm getting a lot better at it but give me .Net any day LOLZath |
 |
|
|
|
|
|
|
|