syntax error at or near "="

Hallo @ll,

ich schreibe in java eine SQL Abfrage bzw. mehrere sql Abfragen.

und kriege folgende Exception:
org.postgresql.util.PSQLException: ERROR: syntax error at or near “=”

...
getOutput(int param){

...

 String sql_avg_rates = "select tag_id, avg(rating) from ratings"+
		  						"where uid = "+param+" group by tag_id";

 ResultSet res=stmt.executeQuery(sql_avg_rates);

result = res.getString(1);
...

ouput result;
}

Dabei wird param als Parameter in die Funtion gegeben: getOutput(int param)


Weiss jemand woran das liegt? mit like geht es auch nicht… :frowning:

Vielen Dank im Voraus…


lg,
hugo

Hallo,

deine Stringverkettung ist fehlerhaft. Nach “from ratings” und vor dem “where uid” muss ein Leerzeichen rein.

cu tb.

Danke :slight_smile:

ab und zu ist man total blind :slight_smile: