>bob...
>
>your example does not appear to work for me. maybe i'm missing
>something? i created two tables simply as:
>
> create table test1 values (id int);
>
> create table test2 values (id int);
>
>and populated them with some matching and non-matching data. however,
>when i run the query:
>
> select test1.id, test2.id from test1 left join test2 using id;
>
>i get the following error:
>
> You have an error in your SQL syntax near 'id' at line 1
Sir, it's not a good idea to trust the syntax of anything I've posted
unless I specifically say that I've run it on my machine. I'm very
absent-minded.
In this case I was only trying to provide a more or less generic
example of a LEFT JOIN, not a syntactically correct example of a
MySQL SELECT statement. By pure luck, the only thing missing is a
pair of parentheses. I've just run the following on my machine, and
it works.
select test1.id, test2.id from test1 left join test2 using (id);
On the other hand, the following does not work:
create table test1 values (id int);
I checked the on-line manual. (Ah ha! The fine manual! We can look in
the manual get answers to syntax questions! Why didn't we think of
that sooner!?) I can't find anything that suggests that you can use
VALUES in a CREATE TABLE statement, so I think you probably used
create table test1 (id int);
which is what I used.
Gee, we solved both problems by using the manual. Dr. Pangloss was
right; this really is the best of all possible worlds!
(Sorry. It's Sunday morning and I'm feeling really silly.)
>any ideas?
Never. I'm not allowed, according to my last date. She said "Don't
get any ideas." It's not working, though. I've been idea-free for
weeks, and she still isn't returning my phone calls.
Bob Hall
>
>
>Bob Hall wrote:
> > SELECT table_a.id, table_b.id
> > FROM table_a LEFT JOIN table_b USING id;
> > would return something like
> >
> > table_a.id table_b.id
> > __________ __________
> > a NULL
> > b b
> > c c
> > d NULL
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
MySQL list magic words: sql query database
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php