surabhi sinha wrote:

Dear sir,
Ihave the following subquery which i intend to use for mysql4.0.12
can u tell me how it could be formed for use since no common column
is there for it to be converted to Inner join



Select CompanyName,City from Company where
CompanyName='Arihant Jain' and City='Delhi'
and companyid in (Select Companyid from Opport where Userid=1
and Opportunityfor=0 Union Select Companyid from Lead where Userid=1
and Qualifyflag=1 union Select companyid from lead where userid=1
and qualifyflag=2 union Select companyid from accountsorder where userid=1);

I'd take the subquery in the 'in' section and turn it into a 'create temporary table' statement, run it first, then run the main query, linking on the Companyid, then when you are finished, drop the temporary table (or let it drop itself when your connection is closed).


--
Daniel Kasak
IT Developer
* NUS Consulting Group*
Level 18, 168 Walker Street
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: www.nusconsulting.com


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to