drewjoh Posted September 16, 2008 Share Posted September 16, 2008 Hi guys, Is it possible (I imagine it surely is somehow) to sort by a field that is just referenced in a table? For example: I have the following tables: 'users' with the fields: user_id, group_id, name, username 'groups' with the fields: group_id, name Is there a way to form a query that will display all the users, but sorted by their group name alphabetically? I can obviously, easily sort by their group_id, but that doesn't benefit me much! (Hope I explained that well enough!) Link to comment https://forums.phpfreaks.com/topic/124503-solved-sorting-by-a-field-referenced-in-a-separate-table/ Share on other sites More sharing options...
drewjoh Posted September 16, 2008 Author Share Posted September 16, 2008 Figured it out, just had to use a JOIN and then sort by the field in the JOINed table. Link to comment https://forums.phpfreaks.com/topic/124503-solved-sorting-by-a-field-referenced-in-a-separate-table/#findComment-643075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.