Need help with an SQL-query
Hi all
Being very unxperienced with SQL i came across a little problem:
I want to have certain criteria to my sql-query, including this one:
get all entries where orderID > 0 and all entries where orderID = 0 (but only where a second value = 0)
Here's what i tried myself (failing..):
SELECT * FROM otime
WHERE cust LIKE 'some name' AND ans LIKE 'hk' AND OrderID > 0 OR (orderID = 0 AND mamID = 0) AND
base = 1 ORDER BY oDate desc
This query does not give the wanted entries, can someone please help me create the correct query?
Re: Need help with an SQL-query
Think I just solved it myself here now :)
SELECT * FROM timelinjer WHERE (( kunde LIKE 'some cust' AND OrdreID > 0 AND base = 1) OR (( kunde LIKE 'some cust' AND ordreID = 0 AND mamutID = 0) OR ( kunde LIKE 'some cust' AND ordreID > 0 AND mamutID > 0) AND base = 1)) ORDER BY Dato desc