A.name AS name_A,
B.name AS name_B
FROM A, B WHERE A.id = B.id
and to access it just use $row['name_A'] ... the variable name still
gave me the information I need
PS: why don't you use LEFT JOIN ??
Well, in my real query it's an inner join. This was just a rather
meaningless example. If you're asking why I use the comma notation, I
just find it a bit more readable than "JOIN... JOIN... JOIN" when
several tables are involved.
> I have the following tables:
> id, name,....
> I want to list the b's of a with name="fizz" for example.
> The one way to do it is :
> SELECT id FROM a WHERE name="fizz" and grab the id. then SELECT *
> FROM ab WHERE aid=id;
> the other is
> SELECT * FROM a,ab WHERE a.name="fizz" AND
IME, I find queries that actually use JOIN to be quite a bit quicker. In
your case, you should try something similar to the following:
SELECT a.name, b.description, ab.grade
INNER JOIN b
INNER JOIN ab ON ab.aid = a.id
ON b.id = ab.bid
WHERE a.name = 'fizz'
>create new table from old table
>old table has place names, say a to z.
> new table has to list all posssible connections, ie, a-b ,a-c , b -a .
> can anyone point me in the right direction for how to do this?
INSERT INTO links
(SELECT from.name, from.lat, from.lon, to.name, to.lat, to.lon
FROM orig_table from
JOIN orig_table to ON from.name<>to.name)
> The following bit of XML barfs with Invalid document end at line 9:
> <?xml version="1.0" ?>
A well-formed XML document can only have a single root element. Here you have two.