Hi, can u please show me how to query 3 tables using *? thanks
+2
A:
You need to do a join on the tables in order to get the columns of all of them.
Warning: using * to get all columns is bad practice. You should qualify (name) all the columns you need.
Here is an example:
SELECT *
FROM table1 t1
INNER JOIN table2 t2
ON t1.key2 = t2.key2
INNER JOIN table3 t3
ON t1.key3 = t3.key3
Oded
2010-03-05 15:17:04
+1
A:
One way you probably don't like:
SELECT *
FROM table1, table2, table3
You have to give way more information.
This generates the Cartesian product of all the three tables.
Felix Kling
2010-03-05 15:17:14
I'm tempted to upvote, but it feels somewhat immoral.
jdv
2010-03-05 15:36:30