Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
like there are product table which contains multiple products with different names, so I have five products name I want to check that did these five products already present in table or not.
Posted
Comments
RedDk 19-Oct-13 15:09pm    
SELECT * FROM [table]
mahaveer singh ratnoo 19-Oct-13 15:15pm    
i have 15 products in table and i have 5 products in different table now i want to check whether all 5 products of table 2 is in table one or not, i want answer in a text box as yes or no

1 solution

Hi,

SQL
SELECT * FROM Table1 where Name in(select Name from Table2)

This will return All those product Name which is present in Table2
if you want to select those which is not in Table2 then

SQL
SELECT * FROM Table1 where Name not in(select Name from Table2)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900