if your tables are large, you'll probably see a better performance from select id from TableA a where not exists (select 1 from TableB b where a.id = b.id)
On Tue, Jun 21, 2011 at 12:41 PM, John M Bliss <bliss.j...@gmail.com> wrote: > > select * from b where id not in (select id from a) > > On Tue, Jun 21, 2011 at 12:37 PM, Jenny Gavin-Wear < > jenn...@fasttrackonline.co.uk> wrote: > >> >> Two tables each containing a shared primary key ID. >> >> I am trying to create a query that lists records from table B that are not >> in table A. >> >> Many thanks, >> >> Jenny >> >> >> >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345495 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm