slq guru help needed: how to select data not in another table using sql 
Author Message
 slq guru help needed: how to select data not in another table using sql

i've have a table in  a database (x)
from my as400 i get a daily updata for that table (y).
tables are indentical for the layout
question is:
how do i retrieve records in
x not in y
y not in x

thanks

wiemer



Thu, 05 Dec 2002 03:00:00 GMT  
 slq guru help needed: how to select data not in another table using sql
select x.*
from x
where x.id not in (select y.id from y)

Liam
http://www.vbexpress.com



Quote:
> i've have a table in  a database (x)
> from my as400 i get a daily updata for that table (y).
> tables are indentical for the layout
> question is:
> how do i retrieve records in
> x not in y
> y not in x

> thanks

> wiemer



Thu, 05 Dec 2002 03:00:00 GMT  
 slq guru help needed: how to select data not in another table using sql
?


Quote:
> i've have a table in? a database (x)
> from my as400 i get a daily updata for that table (y).
> tables are indentical for the layout
> question is:
> how do i retrieve records in
> x not in y
> y not in x

> thanks

> wiemer



Sat, 28 Dec 2002 03:00:00 GMT  
 slq guru help needed: how to select data not in another table using sql

make a Left Join of 2 of your tables, and look for Null value in the second
table
Something Like:
SELECT x.Name, x.ID
FROM x LEFT JOIN Y ON x.id= y.id
WHERE y.id is NULL
you get all records in X that are not in Y



Quote:
> i've have a table in a database (x)
> from my as400 i get a daily updata for that table (y).
> tables are indentical for the layout
> question is:
> how do i retrieve records in
> x not in y
> y not in x

> thanks

> wiemer



Sat, 28 Dec 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. SELECT STATEMENT -- SQL GURU HELP PLEASE

2. SIMPLE HELP NEEDED - Connecting to Databases - not using the Data Control

3. Need help from SQL guru !!!!

4. Need help from SQL guru !!!!!!!!!

5. Need help from SQL guru !!!!

6. Need help from SQL guru !!!!!!!!!

7. Need help from SQL guru

8. sql guru's - need help with an inner join

9. Need SQL Guru Help

10. Data Reporting using a multi-table select as datasource

11. Need Help From API Gurus using VB

12. Display a blank screen if picture data is not found in sql table

 

 
Powered by phpBB® Forum Software