Connecting Tech Pros Worldwide Forums | Help | Site Map

Subquery convertion to run in mysql 4.0

Newbie
 
Join Date: Aug 2008
Posts: 1
#1: Aug 28 '08
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
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Document.DocID 
  2. FROM Document 
  3. Left Join T_ORDER 
  4. ON Document.DocID = T_ORDER.DocID 
  5. WHERE Document.Doc_Date>='08/28/2008' 
  6. AND Document.Doc_Date<='08/28/2008') 
  7. AND ( Document.From_ID 
  8. IN (SELECT Corp_Code.Code FROM Corp_Code WHERE Corp_Code.OrgID=48) OR Document.TO_ID 
  9. IN (SELECT Corp_Code.Code FROM Corp_Code WHERE Corp_Code.OrgID=48) )
  10.  AND Document.DocID 
  11. NOT IN ( SELECT T_ORDER.DocID FROM T_ORDER WHERE T_ORDER.CStatus='DONE' OR T_ORDER.CStatus IS NULL ))
  12.  
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

Reply


Similar MySQL Database bytes