stevebluck Posted October 7, 2009 Author Share Posted October 7, 2009 Thanks, another quick question - how would I ORDER BY the price value? I have tried the following at the end of the query: ORDER BY wp_postmeta ORDER BY p3.meta_key ORDER BY p4.meta_value Neither seem to work Here is my ammened query: SELECT p.* FROM wp_posts AS p INNER JOIN wp_postmeta AS p1 ON (p.ID = p1.post_id) CROSS JOIN wp_postmeta AS p2 USING (post_id) CROSS JOIN wp_postmeta AS p3 USING (post_id) WHERE p1.meta_key='state_value' AND p1.meta_value='Suffolk' AND p2.meta_key='beds_value' AND p2.meta_value='2' AND p3.meta_key='price_value' AND convert(p3.meta_value, signed) >= '100000' Link to comment https://forums.phpfreaks.com/topic/176281-solved-advanced-sql-help/page/2/#findComment-932263 Share on other sites More sharing options...
cags Posted October 7, 2009 Share Posted October 7, 2009 I'd have thought it would be... ORDER BY p2.meta_value But I can't really remember what the output of the Search looked like :S if you provide an example set of data you wish to order I should be able to give better advice. Link to comment https://forums.phpfreaks.com/topic/176281-solved-advanced-sql-help/page/2/#findComment-932270 Share on other sites More sharing options...
stevebluck Posted October 7, 2009 Author Share Posted October 7, 2009 I'd have thought it would be... ORDER BY p2.meta_value But I can't really remember what the output of the Search looked like :S if you provide an example set of data you wish to order I should be able to give better advice. I swear I tried that and it didn't work, but just tried again and it did! So thanks! Link to comment https://forums.phpfreaks.com/topic/176281-solved-advanced-sql-help/page/2/#findComment-932290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.