Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple SQL Multiplication Question

Status
Not open for further replies.

NewbieDBA

MIS
May 1, 2001
17
US
Hi Folks

I am trying to multiply a virtual column by a real column. Can I do this?
Let me show you what I mean:

SELECT REGIS_RATE, Count (REGIS_RATE) AS REG_NO, RATE_AMT, (REG_NO*RATE_AMT) AS TOTAL
FROM MEETING_REGISTRANT
WHERE (MEETING = '1072') AND
(MEETING_REGISTRANT.ORDER_STATUS <> 'C')
Group By REGIS_RATE, RATE_AMT

Query Analyzer doesn't like my virtual column

Server: Msg 207, Level 16, State 3, Line 1
Invalid column name 'REG_NO'.

With out the virtual column these are my results
REGIS_R REG_NO RATE_AMT
FAC 164 0
STAFF 39 0
ACD 6 445
GROUP 198 725
EARLY 33 755
OTH 23 795
REG 5 795


I feel that I am missing something VERY obvious. Any help would be appreciated. Thanks
Adam
 
Including domain function is not consistient w/ including filed. Cant Have FIELD &quot;Regis_Rate&quot; AND Count(Regis_Rate). All fields in Domain aggregate (e.g. &quot;Sum&quot;) query must be aggregate type, except the Where, Group by, ...

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top