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. Quote 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' Quote 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. Quote 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" Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.