lark Posted June 29, 2006 Share Posted June 29, 2006 I'm just learning how to do joins but am having trouble with this. I have two tables like this:Table A Title........ Category Thing 1.........5 Thing 2.........5 Thing 3..........6 Thing 4........12Table BCategory........Order5....................136.....................2012....................1And I want to write a query that gives me this:Title..............Category.........OrderThing 1...........5....................13Thing 2...........5.....................13Thing 3...........6.....................20Thing 4..........12.....................1So each thing has a category. Each category has an order associated with it. I'd like to know the order of each thing based on its category. Make sense?Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/13252-whos-good-at-joins/ Share on other sites More sharing options...
jworisek Posted June 30, 2006 Share Posted June 30, 2006 I think you mean this right?[code]Select title, A.category, order from TableA A INNER JOIN TableB B ON (B.category=A.category) order by title ASC//or it can also be written as:Select title, A.category, order from TableA A, TableB B WHERE A.category=B.category order by title ASC[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13252-whos-good-at-joins/#findComment-51275 Share on other sites More sharing options...
fenway Posted July 3, 2006 Share Posted July 3, 2006 Please use the JOIN syntax, not the theta syntax. Quote Link to comment https://forums.phpfreaks.com/topic/13252-whos-good-at-joins/#findComment-52313 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.