On Thu, 6 Oct 2005, Brett Wilson wrote: > I believe saying "GROUP BY a.primarykey" clause at the end of your > query will do what you want. It's explained in
I would try something like: select sa.dbsource, sa.signid, sa.recid, sa.majorlvl, sa.lvl6 from sampsign sa where sa.dbsource = 'Smith' and sa.majorlvl = 'photograph' and not exists (select j.recid from sgnphoto j where j.recid=sa.recid) > http://sqlite.org/lang_select.html There might also be better ways of > doing it, but I'm not an expert. > > Brett > > On 10/6/05, Robert L Cochran <[EMAIL PROTECTED]> wrote: > > Hi -- > > > > I'm using SQLite v3.2.7 and the tables discussed below are part of an > > SQLite database. > > > > There are 2 tables: A contains some text columns and an integer primary > > key. B contains an integer primary key and a LONGBLOB column to hold > > image data like jpegs. The primary key in B should match one and only > > one primary key in A. At this point, table B has 2 rows and needs to be > > updated with several hundred more. > > > > I want to craft an SQL query that will return every row in A having a > > primary key that does not match the keys in the rows in B. Then display > > I'm inexperienced with joining tables and need help. > > > > these rows on a web page form. I eventually tried doing a left outer > > join of A and B: > > > > select sa.dbsource, sa.signid, sa.recid, sa.majorlvl, sa.lvl6 from > > sampsign as sa left outer join sgnphoto as j on sa.recid = j.recid where > > sa.dbsource = 'Smith' and sa.majorlvl = 'photograph'; > > > > The result set comes extremely close to what I want. The trouble is, it > > includes the 2 rows from A which match the rows in B. I'd like to get > > rid of them and see only the non-matching rows. > > > > Thanks a lot for your help! > > > > Bob Cochran > > Greenbelt, Maryland, USA > > > > > Regards, Mark