gt; Subject: Re: Referencing a query column while still in the query
>
> SELECT d.ItemID, d.Title, d.MediaType,
> (avg(i.BuyersPrice/i.Quantity)
> -avg(q.Cost)*1.175
> -avg(i.BuyersPrice/i.Quantity)*0.15
>
> + CASE mediatype
>
4 8:32 AM
Subject: RE: Referencing a query column while still in the query
I had also considered this but I was just looking for a more "elegant"
solution that got the job done in one go. I am just about to build a new
table with mediatype and shippingcosts in it so I can just joi
SELECT d.ItemID, d.Title, d.MediaType,
(avg(i.BuyersPrice/i.Quantity)
-avg(q.Cost)*1.175
-avg(i.BuyersPrice/i.Quantity)*0.15
+ CASE mediatype
WHEN 1 then 1.1
when 2 then 1
...
END
AS AvgMargin
FROM SomeTables
--- James Smith <[EMAIL PROTE
n [mailto:[EMAIL PROTECTED]
> Sent: 04 August 2004 16:25
> To: CF-Talk
> Subject: Re: Referencing a query column while still in the query
>
> James...you said:
> No good, already considered this but I need to be able to
> sort on the final AvgMargin Column so it must have
Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]
- Original Message -
From: James Smith
To: CF-Talk
Sent: Wednesday, August 04, 2004 8:15 AM
Subject: RE: Referencing a query column while still in the query
> No, you can't reference the value of a column wh
> No, you can't reference the value of a column while building
> the query.
> The column doesn't *have* a value in it until the query is
> built, sent, and the results returned.
That is what I figured.
> However, you could create a helper table to hold the
> appropriate information, and gra
-
| From: James Smith [mailto:[EMAIL PROTECTED]
| Sent: Wednesday, August 04, 2004 17:02
| To: CF-Talk
| Subject: Referencing a query column while still in the query
|
| OK, this time I really am stuck. I have removed quite a lot
| from this query to make it easier to read, normally selects
| more
No, you can't reference the value of a column while building the query.
The column doesn't *have* a value in it until the query is built,
sent, and the results returned.
However, you could create a helper table to hold the appropriate
information, and grab it that way.
Or you could march thr
CF-Talk
> Subject: Referencing a query column while still in the query
>
> OK, this time I really am stuck. I have removed quite a lot from this
> query
> to make it easier to read, normally selects more fields and has WHERE,
> GROUP
> BY and ORDER BY clauses.
>
>
OK, this time I really am stuck. I have removed quite a lot from this query
to make it easier to read, normally selects more fields and has WHERE, GROUP
BY and ORDER BY clauses.
SELECT d.ItemID, d.Title, d.MediaType,
(avg(i.BuyersPrice/i.Quantity)
-avg(q.Cost)*1.175
10 matches
Mail list logo