Support

Account

Home Forums General Issues ORDER BY on SELECT not working Reply To: ORDER BY on SELECT not working

  • Ok, managed to solve it by swapping the SQl round a little, like so:

    			$rows = $wpdb->get_results($wpdb->prepare( 
    			"
    			SELECT * 
    			FROM wp_postmeta
    			WHERE meta_key LIKE %s AND meta_value LIKE %s ORDER BY meta_value ASC",
    			'dates_%_available_dates', ''.$year.''.$month.'%', 			
    			""		
    			));