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 |
|
allenm
Starting Member
11 Posts |
Posted - 2012-03-20 : 09:22:00
|
| Hello, I am new to sql, and I really need some help! I have created this so far: Select * from enc where EpsTyp ='BR'Select * from entid Now that returns me two seperate table results.... in the enc table i have a column named "PatSys" and in entid i have a column named "EntSys" I need to combine those two search results in one table ... or I need to delete all the columns that are not in both. Maybe there is a way to run this so that it only pulls like columns from two seperate tables in one command I am not sure. Thanks, Allen |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-03-20 : 09:31:27
|
Please give table structure, sample data and wanted result. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
allenm
Starting Member
11 Posts |
Posted - 2012-03-20 : 09:35:59
|
Ok how do you need me to give structure? I can upload the two search results as a excel file if that what you need. Basically what I am after if i need to eleminate all the entries in the second search result that were not in the first one... its just basically a way of searching the two tables and pull matching results. quote: Originally posted by webfred Please give table structure, sample data and wanted result. No, you're never too old to Yak'n'Roll if you're too young to die.
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-20 : 15:17:37
|
do you mean this?SELECT PatSys FROM enc where EpsTyp ='BR'INTERSECTSELECT EntSys FROM EntID or this?Select PatSys from enc e where EpsTyp ='BR'and exists (Select 1 from entid where EntSys = e.PatSys ) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|