Hi everyone. I'm new to mySQL but I understand the basics.
I'm just wondering how I would go about the following:
Lookup value from table1 and then retrieve all values in table2 that have the ID from the table1 value that is selected
I think I need to join like the following:
$query= 'SELECT `errorname` FROM `level0` LEFT JOIN `level1` ON `level0ID`=`level1ID`';
But for some reason I'm getting "Column: 'errorname' in field list is ambiguous" ...any ideas? Here are what my tables look like:
Basically all I want to do, is if the user selected level0ID=4, I want to show all level1's who have level0ID=4.Code:+----------+-----------+-----------+------------+-----------+ | level0ID | tibetName | errorName | tibetReady | validated | +----------+-----------+-----------+------------+-----------+ | 4 | AA | AA | 0 | 0 | | 5 | BB | BB | 0 | 0 | | 6 | CC | CC | 0 | 0 | | 7 | DD | DD | 0 | 0 | +----------+-----------+-----------+------------+-----------+ +----------+-----------+-----------+------------+-----------+----------+ | level1ID | tibetName | errorName | tibetReady | validated | level0ID | +----------+-----------+-----------+------------+-----------+----------+ | 5 | aa | aa | NULL | NULL | 4 | | 7 | cc | cc | NULL | NULL | 6 | | 6 | bb | bb | NULL | NULL | 5 | | 8 | dd | dd | NULL | NULL | 7 | | 9 | no | no | NULL | NULL | 0 | +----------+-----------+-----------+------------+-----------+----------+
Thanks.





Bookmarks