Have you checked out the DataQuery post by Martin Hejtmanek? In there you can see some different WHERE conditions, the ones you might use are
Here is another post about Joins. I'd highly suggest against creating your own SQL view as you never know what might happen with an upgrade. If you had to write your own query, do so in the UI, you'd be suprized what you can do in there.