Subquery convertion to run in mysql 4.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yuan22m
    New Member
    • Aug 2008
    • 1

    #1

    Subquery convertion to run in mysql 4.0

    Hi

    I have encounter problem in mysql with my query regarding subquery support. The IN and NOT IN are not supported.
    my client's server is running the old version of mysql and he cant upgrade because of some reasons.

    I read that you can convert this so it can run it in the old version

    The query is below
    [code=mysql]
    SELECT DISTINCT Document.DocID
    FROM Document
    Left Join T_ORDER
    ON Document.DocID = T_ORDER.DocID
    WHERE Document.Doc_Da te>='08/28/2008'
    AND Document.Doc_Da te<='08/28/2008')
    AND ( Document.From_I D
    IN (SELECT Corp_Code.Code FROM Corp_Code WHERE Corp_Code.OrgID =48) OR Document.TO_ID
    IN (SELECT Corp_Code.Code FROM Corp_Code WHERE Corp_Code.OrgID =48) )
    AND Document.DocID
    NOT IN ( SELECT T_ORDER.DocID FROM T_ORDER WHERE T_ORDER.CStatus ='DONE' OR T_ORDER.CStatus IS NULL ))
    [/code]
    I am not really good in creating sql statements. If is not so much to ask can someone help me with this.
    Thanks a lot.

    yuan
    Last edited by Atli; Aug 28 '08, 09:22 PM. Reason: Added [code] tags.
Working...