You are here: Re: Find records without matches « PHP SQL « IT news, forums, messages
Re: Find records without matches

Posted by Tony on 07/08/05 21:58

Jim F wrote:
> Hi,
>
> I have two tables (A and B) with id fields in them, I would like a
> list of ids that are in A but not in B.
>
> How would I do this in SQL?

Let's see - to show ID's that matched:

SELECT tableA.id, tableB.id FROM tableA, tableB WHERE tableA.id=tableB.id

I think it would be simplest to just invert this. Maybe this?

SELECT tableA.id, tableB.id FROM tableA, tableB WHERE NOT
tableA.id=tableB.id

Or perhaps

SELECT tableA.id, tableB.id FROM tableA, tableB WHERE tableA.id != tableB.id

I think the first is more likely to give what you want. Mind you, this is
untested...

--
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация