Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having Trouble With a Query
Message
From
17/02/2006 18:20:03
 
 
To
17/02/2006 16:06:33
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01097119
Message ID:
01097231
Views:
11
>>You could filter out FK with NULLs easily (if they are the problem).
>
>Yes, I know ... but the second example you gave seemed much simpler, so I went with it. <s> I don't know which one would be faster, but I don't have enough data to benchmark it right now.
>

second; MSSQL optimize it.

Fabio

>Thanks,
>~~Bonnie
>
>
>
>
>>Hi Bonnie,
>>
>>You could filter out FK with NULLs easily (if they are the problem).
>>
>>SELECT * FROM mytable mt1
>>  WHERE mt1.FK IS NOT NULL
>>         AND NOT EXISTS ( SELECT * FROM mytable mt2
>>                WHERE mt2.FK = mt1.FK and mt2.date > mt1.date)
>>
>>>Thanks Sergey! The first one didn't work (I assume because of the fact that there can be NULLs in the FK), but the second one worked fine. I needed to tweak it a little more, because I also need to join the second table to further weed out some criteria, but I figured that out easily enough. You gave me a push in the right direction, thanks!!! =)
>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform