In a nutshell, this can be rewritten as a join - no sub-select needed, so no
problem (this is true of the vast majority - albeit not all - sub-selects).

Because the "U" table is missing (indeed, it looks like a lot of your join
informaiton is missing too), there's no way for me to give you an accurate
rewrite as a JOIN, but make Company_Industries a table that you join to,
join it to Company on CompanyID, and add the IndustryID conditions and
you're set.

Rob

-----Original Message-----
From: Benjamin Pflugmann [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 26, 2002 1:04 PM
To: Arul
Cc: MySQL
Subject: Re: How can this Oracle Query converted to MySQL


Hi.

First, I removed the CC to the java list, because this problem is not
java-related in any way.

Second, I suggest you do some reading in the manual, the questions you asked
recently are mostly answered there.

On Wed 2002-06-26 at 15:03:19 +0530, [EMAIL PROTECTED] wrote:
> SELECT
> U.UserID
> FROM
> Transaction_Data T, Rfq_Data R ,Company C
> WHERE
> T.TransactionID = R.TransactionID AND
> (R.Industryid=1 or R.IndustryID IN (SELECT IndustryID FROM 
> Company_Industries  CI WHERE  CI.CompanyID = C.CompanyID))

I started to try to rewrite the query to sub-selects, when I noticed that it
is broken. You have no table aliased to U, so U.UserID makes no sense. And
it looks as if an restriction on Company is missing (else, the sub-query
simply select all IndustrIDs in Company_Industries).

Bye,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to