Daniel Crookston wrote:
Thanks, but switching to Postgres would be more of a pain than just using
these queries the way they are :-)
Dan

(All told I think I've burned about 50 hours on this little problem, what
with all the help I've asked for from other people.)


Well, nuts. You got me really curious but after hacking at it for a few
hours tonight I still couldn't come up with anything. Oh sure, I found 2
or 3 ways that involved subqueries. Of course, I don't profess to be the
best at outer joins. They scare me a little and I usually get them
backwards (left vs right) before I finally end up with the correct
query.

The queries did work flawlessly under Postgres so you might consider
switching if it bugs you enough.

Corey


You've read this:


http://www.mysql.com/documentation/mysql/bychapter/manual_SQL_Syntax.html#Rewriting_subqueries

already right? I'm not 100% sure I understand what you are trying to do, but it seemed like something I was working on a while ago and this:

SELECT * FROM t1 WHERE id NOT IN (SELECT id FROM t2);

Ended up being what I wanted to do more or less, and so I re-wrote it using this:

SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id
                                       WHERE table2.id IS NULL;

Probaby not what you wanted (especially if Corey didn't give this answer), but thought I'd post I've seen people asking about subqueries in MySQL from time to time and this helped me.

Adam Augustine


____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to