Click to See Complete Forum and Search --> : SELECT issue
ixxalnxxi
10-24-2007, 05:01 AM
i have 2 tables that each have 15 rows in them
when i do a "select * from table1, table2" , i get 225 results, obviously the rows are being multiplied (15 * 15 = 225)
what query can i do so that i will only get 30, 15 from table 1 and 15 from table 2?
BrainDonor
10-24-2007, 12:00 PM
what is the common link between the tables?
ixxalnxxi
10-24-2007, 12:56 PM
the only thing common between the two tables is a 'stage' column.
is it impossible to pull 2 tables in a query if they have nothing in common (meaning no matching columns?)
BrainDonor
10-24-2007, 12:59 PM
the only thing common between the two tables is a 'stage' column.
is it impossible to pull 2 tables in a query if they have nothing in common (meaning no matching columns?)
No, it's not impossible, but you might end up with a lot more rows (225) than you counted on.
try this: select * from table1, table2 where table1.stage=table2.stage
ixxalnxxi
10-24-2007, 02:14 PM
woah, brain..... not only does that shorten the rows it returns, but it makes my job so much easier matching the stages o_O thanks !
you have simplified my work so much ~
BrainDonor
10-24-2007, 02:22 PM
Glad to help. You may want to look into learning some basic SQL syntax. To be honest, the first book I picked up on SQL when I was first getting started was "SQL for Dummies." :o
It was very helpful and written so it wouldn't put you to sleep while reading it. ;)