DJ Unique Posted February 26, 2007 Share Posted February 26, 2007 Hi, I want to right a sql query that will sort 2 columns alphabetically, and then only show the results from the last 50 entries. How can I do this? This is what I have so far: SELECT * FROM manufacturer_detail INNER JOIN handset_detail ON manufacturer_detail.manufacturer_detail_id=handset_detail.manufacturer_detail_id INNER JOIN handset_type ON handset_detail.handset_code=handset_type.handset_code $where ORDER BY manufacturer_name, handset_model Quote Link to comment https://forums.phpfreaks.com/topic/40161-solved-sql-query-sorted-by-3-columns/ Share on other sites More sharing options...
fenway Posted February 26, 2007 Share Posted February 26, 2007 How? Quote Link to comment https://forums.phpfreaks.com/topic/40161-solved-sql-query-sorted-by-3-columns/#findComment-194462 Share on other sites More sharing options...
DJ Unique Posted February 26, 2007 Author Share Posted February 26, 2007 How? I used the A subquery: SELECT * FROM (SELECT * FROM manufacturer_detail INNER JOIN handset_detail ON manufacturer_detail.manufacturer_detail_id=handset_detail.manufacturer_detail_id INNER JOIN handset_type ON handset_detail.handset_code=handset_type.handset_code $where ORDER BY handset_detail_id DESC LIMIT 150) t1 ORDER BY manufacturer_name, handset_model Works perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/40161-solved-sql-query-sorted-by-3-columns/#findComment-194570 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.