grinel Posted April 14, 2006 Share Posted April 14, 2006 Hey guysI need a help with a queryI have 2 tables[b]table 1[/b]code,description[b]table 2[/b]field,field2,code1,code2, field3, etccode1,code2 in table 2, their descriptions can be found in table 1.i want a query to show me all the records in table 2, but with the codes description instead of the code itselfThe result set must therefore have 2 fields for desription, because code1 will not equal code 2I am stuck with mysql 3.23....Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/7427-mysql-querry-problem/ Share on other sites More sharing options...
wickning1 Posted April 14, 2006 Share Posted April 14, 2006 [code]SELECT a.field1, a.field2, b.description as descr1, c.description as descr2, a.field3, a.etc FROM table2 a LEFT JOIN table1 b ON b.code=a.code1 LEFT JOIN table1 c ON c.code=a.code2[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7427-mysql-querry-problem/#findComment-27055 Share on other sites More sharing options...
grinel Posted April 17, 2006 Author Share Posted April 17, 2006 HeyThanks alotI really appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/7427-mysql-querry-problem/#findComment-27675 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.