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 |
sanjeebparida
Starting Member
1 Post |
Posted - 2005-10-10 : 07:07:11
|
suppose there are two tables emp and amp1having fields as table empempname empno dessigsanjeeb 111 managerrajeeb 112 engineer ----------------- table emp1empname empno sanjeeb 111 rajeeb 112 rohit 345-------------------now my query is how i'll select q1>get me the rows available in emp and not in emp1q2>get me the rows available in emp1 and not in empq3>get me the columns available in emp but not in emp1q4>get me the columns available in emp1 but not in emp |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-10 : 07:25:30
|
[code]1 Select * from emp T where not exists(Select * from emp1 where empname=T.empname)2 Exchage table names from 13 select Column_name from information_schema.columns T where table_name ='emp'and not exists(select * from information_schema.columns where table_name='emp1' and column_name=T.Column_name)4 Exchage table names from 3[/code]Refer these for basics of SQL querieswww.sqlcourse2.comhttp://www.firstsql.com/tutor.htmMadhivananFailing to plan is Planning to fail |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-10-10 : 08:35:11
|
Hmmm....some marks for persistance!None....for originality.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56249 |
|
|
|
|
|