mysql - Not Unique Table Alias error in java -


i have 2 tables:

error table

id, loc, no, mesg, psg, stu, auth 

user table

id, name, sname, ptg 

id's primary keys, ptg , psg have same records,

and sql syntax use in swing project,

string sql = select error.id, user.name, user.sname, error.loc, error.no, error.msg                  error, user                 error.stu = '1'                 , (user.ptg = error.psg , error.auth = '5' 

error is:

com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: not unique table/alias: 'error' 

there several errors in query. first, , important, join clause without condition:

"from error, user"

when wish join 2 tables using comma instead of join command, put linking condition in clause:

"from error, user error.userid = user.id"

second error double quote (") after '1'. remove it.

third error unclosed bracket "(" in last line. remove it.

try , post here results.

cheers


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -