I've two tables.



Things i am doing takes all values from wordpress_term_associations

$results = $wpdb->get_results("SELECT `object_id` 
                               FROM `wp_term_relationships` 
                               WHERE `term_taxonomy_id`='".$cat_id."'");

after which taking for every values which i need

foreach($results as $result){

   $postarrayStringINT[] = $result->object_id;

    $results2 = $wpdb->get_results("SELECT * FROM `wp_posts` 
                                    WHERE `ID`='".$result->object_id."' ");

However i need them to stay in correct order, which is menu_order table in wordpress_posts, how to do this ?

I tryied something of that nature :

"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 this ? How to get one value from table and sort/order by it by other tables values ?

You should attempt something of that nature:

SELECT field1, field2, field3, etc... 
FROM wp_posts
INNER JOIN wp_term_relationships on wp_posts.id = wp_term.object_id
WHERE term_taxonomy_id=".$cat_id."
ORDER BY menu_order