Hi there,

I am creating a tracking system for the consumables we give
away to our staff. It is working but I need to know if there is a better practice than 
I what I did

I need to print reports via a website so I used ASP

It needs name,product, amount per item, price per item and total per order.
This is pretty straightforward 

My query looks like this

sqltext1 = "Select orders.orderdate AS orderdate,orders.user AS user , 
products.productname AS productname, orders.amount as amount,products.price AS Price,"
sqltext1 = sqltext1 & " (amount* price) AS subtotal from orders,products where 
orders.product = products.productid"
sqltext1 = sqltext1 & " and cluster = '" & cluster & "' and orderdate > '" & printdate 
& "'  order by orderdate;"

Now the other thing I need is the total of all orders so I created a 2nd query

sqltext2 = "Select sum(orders.amount * products.price) AS total from orders,products 
where orders.product=products.productid AND cluster = '" & cluster & "'and orderdate > 
'" & printdate & "';"

I have the required result but is there some way I can have everything in one query

G

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to