Tim Blair wrote:
> 
> You could do that with some nasty left join statements (untested):
> 
> SELECT cus.Customer_ID
> FROM order_no AS ord
>     INNER JOIN customers AS cus ON (ord.Customer_ID = cus.Customer_ID)
>     LEFT JOIN users AS us ON (us.Customer_ID = cus.Customer_ID)
>     LEFT JOIN order_no AS ord2 ON (ord2.Customer_ID = cus.Customer_ID)
>     LEFT JOIN account AS acc ON (acc.Customer_ID = cus.Customer_ID)
> WHERE ord.Order_No = #Order_No#
>   AND ord2.Order_No <> ord.Order_No
>   AND cus.User_ID = 0
>   AND us.Customer_ID IS NULL
>   AND ord2.Customer_ID IS NULL
>   AND acc.Customer_ID IS NULL

That is not the same as the original. For the following dataset 
they will produce different resultsets if #Order_No# = 7.

customers:
Customer_ID
1
2
3

order_no:
Customer_ID     Order_No
1               NULL
2               7
2               NULL

I don't know of any single SQL statement that could generate the 
same resultset as the original query and that would work on MySQL 
3.x.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199894
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to