4

I have a very simple DB consisting (for this example) of two tables: Users and UserOrders

I want to select a list of users where there are UserOrder association (so user orders are not NULL).

I have tried using .isNotNull(), but either I'm using it wrong, or it doesn't work the way I expect it to.

For example, where userOrdersList is the name of the @ManyToOne field in the Model:

List<User> User.find.where().isNotNull("userOrdersList").findList();

and where UserOrders is the actual name of the table

List<User> User.find.where().isNotNull("UserOrders").findList();

I'm kind of new getting back to SQL, but as I recall basically what I'm looking for is a Left Excluding Join (meaning it excludes any null results)

biesior
  • 55,576
  • 10
  • 125
  • 182
sean.boyer
  • 1,187
  • 16
  • 24

0 Answers0