Mutley Posted December 5, 2006 Share Posted December 5, 2006 I want to list all the rows from "name" where the data in "name" matches "field_1" in a different table.This is a really crazy guess to give you an idea:[code]SELECT field_1 FROM ipb_tablespfields_content WHERE name FROM ipb_tablesmembers = field 1 FROM ipb_tablespfields_content[/code]Anyone know how to do this? Thanks. Link to comment https://forums.phpfreaks.com/topic/29581-2-tables-matching-a-colum-in-each/ Share on other sites More sharing options...
artacus Posted December 5, 2006 Share Posted December 5, 2006 Thats what joins are for. SELECT *FROM table1 as tJOIN otherTable AS o ON t.thing_id = o.thing_idWHERE o.stuff = 'here' Link to comment https://forums.phpfreaks.com/topic/29581-2-tables-matching-a-colum-in-each/#findComment-135737 Share on other sites More sharing options...
Mutley Posted December 5, 2006 Author Share Posted December 5, 2006 I don't understand that, sorry.So my tables are:[color=brown][i]table field[/i][/color]ipb_tablesmembers nameipb_tablespfields field_1So what would it be? what is "AS o ON"? Thanks artacus. Link to comment https://forums.phpfreaks.com/topic/29581-2-tables-matching-a-colum-in-each/#findComment-135740 Share on other sites More sharing options...
artacus Posted December 5, 2006 Share Posted December 5, 2006 SELECT * FROM ipb_tablesmembers AS memJOIN ipb_tablespfields AS fld ON mem.name = fld.field_1Assuming that mem.name and fld.field_1 "match" Link to comment https://forums.phpfreaks.com/topic/29581-2-tables-matching-a-colum-in-each/#findComment-135747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.