문제

Ok, so I can't seem to get this to work, but here is what I wan't to do. I have 2 tables one

like this

Table1
----------
Row1


And this

Table2
----------
Row2


I want to get the data from Table1 where Row2 equals "thisvalue", in php. Any idea how I should go about doing this? Thanks.

도움이 되었습니까?

해결책

You join the tables together

SELECT table1.* FROM table1 t1 JOIN table2 t2 ON t1.row1 = t2.row2

If you want only a row with a specific rw2-value, you can specify that in the WHERE clause

SELECT table1.* FROM table1 t1 JOIN table2 t2 ON t1.row1 = t2.row2 where t2.row='your value'
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top