java - SQL statement (Order by) -


I need to order my data from the latest date

This SQL statement works

  Select the final string SQL = "Choose from the questionnaire * where user profile =" + UserprofileID;   

This SQL statement ** is not working **

  select the final string from SQL = "questionnaire * Choose * where Userprofiled = "+ UserprofileID +" Order by Order by Dar ";   

Error message:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: There is an error in your SQL syntax;

You need to add a location before ORDER:

  select the final string sql = "Select from questionnaire * where userprofileid =" + userprofileID + "sorted According to date ORDER ";    

Comments