File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes mySQL Inner join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "mySQL Inner join" Watch "mySQL Inner join" New topic

mySQL Inner join

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270

I am having a problem with a SQL query and inner join.

My problem is that I only want rows to be returned IF invoicelog.statusCode != 'OK' is true. The "statusCode = OK" may NOT exist in the rows being returned.

The query below returns one row with invoiceID = 2663, even that statusCode = OK does exists in one of the two rows being returned from invoicelog.

Running the query:

it returns two rows:

So how do I ensure that I donĀ“t get any rows returned if "StatusCode = OK" exists in one of the rows from table invoicelog .
Jan Cumps

Joined: Dec 20, 2006
Posts: 2565

You can use 'not 'exists':
or 'not in':

OCUP UML fundamental and ITIL foundation
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: mySQL Inner join
jQuery in Action, 3rd edition