I'm a bit confused here... I need to select everything from multiple tables, but am not sure why my query won't execute... I would use Unions, but MySQL don't support them...
I have 3 tables in one database.
Query: select * from table_1, table_2, table_3 where name = "someName";
The data in those tables is different.
May be I need to use joins, to join 3 tables? Can't figure out what to do.
What is the error you get when you run the query from the command line or phpMyAdmin?
I suspect it might be.. name clause is ambiguous. Try:
Select * from table_1,table_2,table_3 where table_1.name='somename'
specifying what table name should come from
Yes, I get "name clause is ambiguous" error message.
I can't use "where table_1.name" because:
1. the data it all 3 tables is different
2. the "name" comes from an input box:
<input type="text" name="some_name">
So I need to search all 3 tables for "$some_name"...
select * from table_1,table_2,table_3 where name = \"$some_name\"
Last edited by Pweb; Apr 25, 2001 at 10:33.
sure no problem..
select * from table_1,table_2,table_3
where table_1.name = "$some_name"
or table_2.name = "$some_name"
or table_3.name = "$some_name"
btw, that is a standard join except you're using ,commas, instead of the JOIN structure