ridiculous Posted March 14, 2007 Share Posted March 14, 2007 Can't find any documentation on this, and the only workarounds I've seen are ridiculous-like me. This code doesn't work for MySQL, because MySQL is flitty. mysql_query (" Select MAX(price) as ask2, sum(quantity) as bid_1 from 85068ramiros13 where action ='sell' AND price NOT IN(SELECT MAX(price) FROM 85068ramiros13 ORDER BY PRICE desc limit 2 ) GROUP BY PRICE desc limit 2 ") Sing with me, from Foreigner: "Urgent, emergency. Urgent, urgent, urgent...emergency. " Link to comment https://forums.phpfreaks.com/topic/42622-solved-getting-the-3rd-value-in-a-mysql-table-column/ Share on other sites More sharing options...
ridiculous Posted March 14, 2007 Author Share Posted March 14, 2007 This will get you the second value in a column, but I can't figure out how to augment it to retrieve the 3rd. mysql_query (" Select MAX(price) as ask2, sum(quantity) as bid_1 from table where action ='sell' AND price NOT IN(SELECT MAX(price) FROM table ORDER BY PRICE) GROUP BY PRICE desc limit 2 ") Link to comment https://forums.phpfreaks.com/topic/42622-solved-getting-the-3rd-value-in-a-mysql-table-column/#findComment-206831 Share on other sites More sharing options...
ridiculous Posted March 14, 2007 Author Share Posted March 14, 2007 Urgent...emergency Link to comment https://forums.phpfreaks.com/topic/42622-solved-getting-the-3rd-value-in-a-mysql-table-column/#findComment-206832 Share on other sites More sharing options...
ridiculous Posted March 14, 2007 Author Share Posted March 14, 2007 Well, if you want something done you have to do it yourself. GROUP BY PRICE ORDER BY PRICE ASC LIMIT 1,1 That's it. Group and order, then limit. So crzy. Link to comment https://forums.phpfreaks.com/topic/42622-solved-getting-the-3rd-value-in-a-mysql-table-column/#findComment-206874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.