Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Query: Subtraction one set from another set in MySQL

Codes here !

Moderators: macek, egami, gesf

Postby Elena Mitovska » Mon Dec 09, 2002 12:08 am

One of ways you can select those IDs from one table that are not contained in other table is:

select distinct A.ID from A LEFT OUTER JOIN B ON A.ID=B.ID WHERE B.ID is NULL

This select statement will create pair of corresponding rows from both tables, those IDs of table A, that are not contained in table B, will have NULL matching values from table B.
Elena Mitovska
New php-forum User
New php-forum User
 
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine

Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.