Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

selecting from 2 tables - left joins?

Quote Reply
selecting from 2 tables - left joins?
Hello!

Here's what I'm trying to do... I've got 2 tables in my database - A & B.

A has multiple columns, one of which = gid.
B has 2 columns = pid_fk, gid_fk.

The gid_fk column in B is a foreign key that relates to the gid column in table A.

What I want to do is select all the records in table A that DON'T have a corresponding record in table B. ie. select all those from A whos gid "does not" appear in B as a gid_fk.

Then I also need code that does the opposite - select all records from A whos gid "does" appear in B as a gid_fk.

I believe it's done with a left join statement but I can't figure out how to use it.

Can anyone help?

Thanks!
Subject Author Views Date
Thread selecting from 2 tables - left joins? ryel01 1261 May 25, 2005, 2:20 AM
Post Re: [ryel01] selecting from 2 tables - left joins?
afinlr 1148 Jul 18, 2005, 2:29 PM