aspose file tools*
The moose likes JDBC and the fly likes querying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "querying " Watch "querying " New topic
Author

querying

Sid Sharama
Greenhorn

Joined: Feb 06, 2005
Posts: 11
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Sep 06, 2000
Posts: 51
satyakhjkljhkj,
Good one, nothing more annoying than blaming java for your own logic flaw.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: querying