Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WHERE IN approach
Message
From
01/03/2017 12:00:27
 
 
To
01/03/2017 09:46:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
OS:
Windows 8.1
Network:
Windows Server 2012
Miscellaneous
Thread ID:
01648591
Message ID:
01648677
Views:
34
>Probably I don't understand the type of query you are doing. If you have all the values hardcoded then go with that.

Here is an example:
SELECT Thread.Numero
 FROM Thread
 WHERE Thread.NoStatus=1 AND (Thread.NoClient=1 OR Thread.NoClient=2)
That specific one can benefit of a compound index on NoStatus+NoClient.
SELECT Thread.Numero
 FROM Thread
 WHERE Thread.NoStatus=1 AND
  EXISTS (SELECT ForumCli.Numero FROM ForumCli WHERE ForumCli.NoMember=1 AND (ForumCli.NoClient=1 OR ForumCli.NoClient=2))
That specific one uses the EXISTS to see if the child table has records.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform