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 |
|
lamujerdetuhermano10
Yak Posting Veteran
75 Posts |
Posted - 2008-08-25 : 13:06:03
|
| can u improve this statement?FROM vInventoryLineItem v JOIN [Global].[InventoryAilmentLink] [IA] ON v.InventoryID = IA.InventoryIDJOIN [Global].[AILMENT] [AIL] ON IA.AilmentID = AIL.AilmentID JOIN [Global].[InventorySpeciesLink] ISL ON v.[InventoryID] = [ISL].[InventoryID] WHERE (v.idMinAge < @daysOld or v.idMinAge is null ) AND (v.idMaxAge > @daysOld or v.idMaxAge is null) AND v.idStartDate < @now AND (v.idEndDate > @now or v.idEndDate is null) AND [AIL].[AilmentId] = @ailmentID AND isl.[SpeciesID] = @speciesID AND ((@genderCode = 'M' AND ISL.IsForMale = 1) OR (@genderCode = 'F' AND ISL.IsForFemale = 1) OR (@genderCode = 'MN' AND ISL.IsForNeutered = 1) OR (@genderCode = 'FS' AND ISL.IsForSpayed = 1) OR (@genderCode = 'UN')) AND v.idCountryCode = @countryCode AND (v.pcCountryCode = @countryCode OR v.PcCountryCode is null) ORDER BY [IA].[ListOrderNumber] |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-08-25 : 13:11:12
|
| Only try to improve this already perfect query if you are an expert! I'm not an expert, so I'd probably start with adding a SELECT clause.Jim |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-25 : 13:34:45
|
ISL.IsForNeutered this takes the cake and you forgot to say please._______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-26 : 02:01:53
|
I don't think "u" can do this. Maybe "h" can? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2008-08-28 : 16:49:07
|
quote: Originally posted by lamujerdetuhermano10 can u improve this statement?
Yes. Try: "Can you improve this statement?". It has superior spelling and capitalization.Boycotted Beijing Olympics 2008 |
 |
|
|
|
|
|