This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • 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;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic