-2

Rather simple, I have a one to many / many to one relation and I'd like to query it. However, I don't want any results returned when it isn't provided with any WHERE clause information.

In simpler terms, how do I make a query non-greedy?

Alexander Trauzzi
  • 7,277
  • 13
  • 68
  • 112

1 Answers1

2

You could add a where clause that is always false and append the condition you want supplied with OR:

select * from table where 1 = 0 OR (real conditions)
Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443