|
-
Sep 25th, 2006, 02:16 AM
#1
Thread Starter
Lively Member
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?
Last edited by Riks; Sep 25th, 2006 at 03:07 AM.
2B || !2B
-
Sep 25th, 2006, 03:06 AM
#2
Thread Starter
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|