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 |
|
josephdickhoener
Starting Member
1 Post |
Posted - 2007-12-17 : 17:02:58
|
| need to know how to check both table data and return only data that doesn't match the other table dataselect distinct dept_namefrom bb_guide_party_dept d, binbox_dept e where d.dept_id = e.dept_id and e.active_Flag = 1unionselect distinct dept_namefrom bb_guide_party_dept a, binbox_dept b where a.dept_id = b.dept_id and e.dept_name not the same as b.dept_name |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-17 : 17:09:47
|
[code]select e.dept_namefrom bb_guide_party_dept as dinner join binbox_dept as e on e.dept_id = d.dept_idand e.active_Flag = 1unionselect b.dept_namefrom bb_guide_party_dept as ainner join binbox_dept as b on b.dept_id = a.dept_id [/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-17 : 17:11:52
|
Using SQL Server 2005?select e.dept_namefrom ( select e.dept_name, ROW_NUMBER() OVER (PARTITION BY e.dept_name ORDER BY e.active_Flag DESC) AS RecID from bb_guide_party_dept as d inner join binbox_dept as e on e.dept_id = d.dept_id ) as dwhere RecID = 1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-12-18 : 06:21:29
|
| third party tool is there for thisVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
|
|
|