RE: Referencing a query column while still in the query

2004-08-05 Thread James Smith
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 >   

Re: Referencing a query column while still in the query

2004-08-04 Thread Bryan Stevenson
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

Re: Referencing a query column while still in the query

2004-08-04 Thread I-Lin Kuo
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

RE: Referencing a query column while still in the query

2004-08-04 Thread James Smith
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

Re: Referencing a query column while still in the query

2004-08-04 Thread Bryan Stevenson
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

RE: Referencing a query column while still in the query

2004-08-04 Thread James Smith
> 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

RE: Referencing a query column while still in the query

2004-08-04 Thread Hugo Ahlenius
- | 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

Re: Referencing a query column while still in the query

2004-08-04 Thread Ben Doom
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

RE: Referencing a query column while still in the query

2004-08-04 Thread Pascal Peters
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. > >

Referencing a query column while still in the query

2004-08-04 Thread James Smith
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