-
Mar 7th, 2007, 07:45 PM
#1
[Resolved]mysql question
Is it possible to do something like this:
Select (amount*days*people) as totalCost, sum(amtPaid) as amountPaid, (amountPaid - totalCost) as thisparthere?
Where I compute 2 fields and then do a calculation on them? I have been trying it, but I can't find a way to do it.
Would I have to use a temporary table or a view?
Last edited by kfcSmitty; Mar 7th, 2007 at 11:58 PM.
-
Mar 7th, 2007, 08:45 PM
#2
Frenzied Member
Re: mysql question
I don't know, but that is a good question. Could totalCost be a subquery? I suppose instead of using totalCost in (amountPaid - totalCost) you could substitute the subquery for totalCost.
There are a lot better SQL folk here than me, but maybe this would work for you.
Tengo mas preguntas que contestas
-
Mar 7th, 2007, 11:57 PM
#3
Re: mysql question
I decided to go with a view, although I think a subquery would have worked as well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|