Results 1 to 3 of 3

Thread: [Resolved]mysql question

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Resolved [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.

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    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

  3. #3

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    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
  •  



Click Here to Expand Forum to Full Width