tags:

views:

81

answers:

4

I would like to select a row from 2 different tables that are relational. Would i simply put

SELECT * FROM 'said database' WHERE my condition = 'mycondition' blah blah.

Or is it some other syntactical method?

Please help. :)

All answers are greatly appreciated.

+2  A: 

It would need to be something like:

Select * from Table1 inner Join Table2 ON Table1.field_condition_from_table_1 = Table2 .field_condition_from_table_2 where Table1.condition_from_table_1 = "your_condition"

And that will do the trick. There's other ways you can do it, but this way will bring whatever you need in common from the two tables

Marcos Placona
Thank You Mplacona!
Tapha
+3  A: 

Try this:

SELECT * FROM TableA A INNER JOIN Table B ON A.Id = B.Id WHERE condition = 'mycondition'
37Stars
Thank You 37starz! Stack Overflow is just awesome, Just to clarify the dots are part of the syntax? ive never used those in sql before.
Tapha
A: 

This (roughly) will do the trick for you.

select <data> from table1
inner join table2 on table1.column = table2.column
where <mycondition>

Learn more about joins from the MySQL Manual.

Mike
A: 

Comprehensive join syntax here.

marr75
Really? Downvoted for linking to the manual?
marr75