I have 2 tables:
id, loc, no, mesg, psg, stu, auth
id, name, sname, ptg
id's are primary keys, ptg and psg have same records,
And this is my SQL syntax that I use in Swing project,
String SQL = SELECT error.id, user.name, user.sname, error.loc, error.no, error.msg
FROM error, user
WHERE error.stu = '1'
AND (user.ptg = error.psg AND error.auth = '5'
Error is:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Not unique table/alias: 'error'
There are several errors in this query. The first, and most important, is the JOIN clause without a condition:
"FROM error, user"
When you wish to join two tables using a comma instead of a JOIN command, put your linking condition in the WHERE clause:
"FROM error, user WHERE error.userid = user.id"
Second error is the double quote (") after '1'. Remove it.
Third error is the unclosed bracket "(" in the last line. Remove it.
Try this and post here the results.
Cheers
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.