• Post Reply Bookmark Topic Watch Topic
  • New Topic

What Is the Correct Syntax?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am searching a database, order the search result by some criterion supplied by users and ASC/DESC is also supplied by user's selection. How do I write the query statement?
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String query = "SELECT thread_id, message_receiver, message_sender, article_title FROM message_thread WHERE message_receiver = '" + memberName + "' ORDER BY " + sortCriterion + " " + order;
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!