Results 1 to 2 of 2

Thread: Need help with an SQL-query

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    69

    Resolved 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

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    69

    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
    2B || !2B

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width