I have two tables.
wp_term_relationships
term_taxonomy_id
...
wp_posts
ID
...
menu_order
What i am doing is taking all values from wp_term_relationships
$results = $wpdb->get_results("SELECT `object_id`
FROM `wp_term_relationships`
WHERE `term_taxonomy_id`='".$cat_id."'");
and then taking for each values that I need
foreach($results as $result){
$postarrayStringINT[] = $result->object_id;
$results2 = $wpdb->get_results("SELECT * FROM `wp_posts`
WHERE `ID`='".$result->object_id."' ");
But I need them to be in correct order, and that is menu_order table in wp_posts, how to do so?
I tried something like that :
"SELECT `object_id` FROM `wp_term_relationships`
WHERE `term_taxonomy_id`='".$cat_id."' JOIN (SELECT * FROM 'wp_posts')
ORDER BY 'menu_order'"
How to do so ? How to take one value from table and sort/order by it by other tables values ?
You should try something like that: