0

I'm new to mysql.

I've got this query:

$tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID);

I need to order it by desc; Due to double-quotes I'm not sure where to add order by desc. Can please anyone point me out where should I add it?

Thank you.

1 Answer 1

1
$tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID ." ORDER BY DESC");
3
  • 1
    You are welcome. Remember to use the codex if you get stuck [link]codex.wordpress.org/Class_Reference/wpdb[/link] - Please accept my answer :) Commented Sep 25, 2017 at 14:14
  • Accepted :) but unfortunately I don't have enough reputation so my vote isn't visible, but thanks again:) Commented Sep 26, 2017 at 13:53
  • No worries, glad I could help :) Commented Sep 26, 2017 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.