Sorry, mailed it in html format. Read answer below
Original Message
Subject:Re: Where clause question
Date: Tue, 12 Oct 2004 00:00:12 +0200
From: Morten Egan <[EMAIL PROTECTED]>
To: Ed Lazor <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Not kno
- Original Message -
From: "Ed Lazor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 4:51 PM
Subject: RE: Where clause question
Interesting. I thought you could sort by aliases. Thanks Shawn.
The easy answer was to just add the calculati
Interesting. I thought you could sort by aliases. Thanks Shawn.
The easy answer was to just add the calculation to the where section as
well. But which approach is faster - "having" or the calculation?
Ie.
select ID, Title, MSRP, Price, round( ( (MSRP - Price) / MSRP) * 100) as
discount from
r HAVING.
Eamon Daly
- Original Message -
From: <[EMAIL PROTECTED]>
To: "Ed Lazor" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 3:51 PM
Subject: Re: Where clause question
Because
Because "discount" isn't one of:
1) a field on one of the tables your query is based on
2) a formula based on one or more of the fields from one or more of the
tables your query is based on.
What it is: an alias to the results of a function applied to 2 fields on
one of your tables.
Since the
I'm getting an unknown column error for discount with the following query.
Any idea why?
-Ed
SELECT ID, Title, MSRP, Price, round( ( (MSRP - Price) / MSRP) * 100) as
discount
FROM `products`
where discount > '10'
limit 10
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/
a function.
>
>Regards
>
>Peter Goggin
>
>- Original Message -
>From: "Alex Shi" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Monday, October 07, 2002 6:47 AM
>Subject: where clause question
>
>
>> Hi,
>>
>> I
This requires a similar function to Oracles decode. I do not know if MySQL
provides such a function.
Regards
Peter Goggin
- Original Message -
From: "Alex Shi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 07, 2002 6:47 AM
Subject: where
Hi,
I need a where clause in following situation:
Say I want to query two tables: A and B. In table A there is field Afn,
while in table B there ere 3 fields: Bfn1, Bfn2 and Bfn3. I want to
compose a query, in which the where clause can do this:
if A.Afn=1, then check Bfn1,
if A.Afn=2, then c