Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

querying

 
Sid Sharama
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to retrieve those records that have salary>5000
recently(date ) and bonus >2000.
i wrote
stmt.executeQuery("select * from emp where sal>5000 and empid>2000")
this is not working.
something wrong with the statement?please let me know how to use logical operators in where clause.
thanks,
sri
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks good to me...
Try adding a ';' to the end of your sql statement.
Depending upon you driver and/or db engine. The ';'
may be required.
hope this helps, Monty6
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello! bmw,
u r statement is
to retrieve those records that have salary>5000
recently(date ) and bonus >2000.
i wrote
stmt.executeQuery("select * from emp where sal>5000 and empid>2000")
this is not working.

here u want to retrieve the records whosa sal > 5000 and bonus > 2000
and but in the query u have mentioned select * from emp where sal > 5000 empid > 2000")
change the empid to bonus and try .,I think there is no problem with teh statement.try this and in case any probelm , let me know.
satya
 
Apu Nahasapeemapetilon
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
satyakhjkljhkj,
Good one, nothing more annoying than blaming java for your own logic flaw.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic