• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

is this SQL Stament correct ???

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
stmt=conn.prepareStatement("select * from klasseFaecher"+" where Klasse like'"+klasse+"'"+"where '"+kfach+"'=ja");
this statement displays a "missing operator" error...
please help....it urgent
vikas
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to group two "where" clauses like that you really need a relation; I assume you mean "AND" in this case. You should also be careful to quote all text constants but not column names (is ja really a column name or does kfach contain the column name and 'ja' the value?), and make sure there are spaces round each keyword.
A rewritten version might therefore be:

I also strongly recommend that you get in the habit of specifying the columns to return in your SQL. It makes your software much more robust if the order of the columns in the table changes, or if new columns are added for other purposes. It also makes it much easier for reviewers and other helpers to understand
 
vikas de
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot...
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic