Re: Simple SQL query question



On 11 Jan 2006 10:13:11 -0800, Erich93063 wrote:

>I am trying to query a table of items There is a field for the name of
>the item, price, quantity etc. When I query I would like to return a
>"total price" which would be price * quantity and alias it out as
>"Total". So something along the lines of:
>
>SELECT vchrItem,
> monPrice,
> intQuanity,
> (monPrice * intQuantity) AS Total,
> ...
>FROM ...
>WHERE intTableID = 12345
>
>Obviously thats NOT how you do it but that is what I am trying to do.

Hi Erich93063,

This is EXACTLY how you do it.

Did you run the code and get an error or incorrect results? If so,
please post more specific information (e.g. the text of the error
message) to help us troubleshoot. See www.aspfaq.com/5006 to find out
what information we need to help you.

--
Hugo Kornelis, SQL Server MVP
.



Relevant Pages

  • Re: A Question of Tables
    ... Without getting into your specific query, ... > price (which should be in the STOCKPRICES table) with this exchange rate. ... > selected lang and currency, ...
    (microsoft.public.sqlserver.programming)
  • Re: Adding a new parent key for a new child record on a subform
    ... The above query will make it impossible to display or enter OrderItems ... Private Sub Form_BeforeInsert ... vendor, simple enough. ... latest price and insert it as this order-line-items new price: ...
    (microsoft.public.access.forms)
  • Re: adding a text string to data from one field in one database to another
    ... After running the other create table query, ... I have items with price breaks a various quantity levels each ... Qty price at that qty price for that qty ... In the database the data needs to be entered into a field (not ...
    (comp.databases.ms-access)
  • Re: Compare record count in table1 to qty in table2?
    ... Here is a query I'm trying to use and, of course, it does not work: ... INNER JOIN Item_Serial ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: Need help with expression on a query
    ... The code create a form in a webpage and the query is to update the data on ... Part, Description, Price, and Code columns. ... >> In the Form Button Memo I have the following code: ...
    (microsoft.public.access.queries)