Showing posts with label qty. Show all posts
Showing posts with label qty. Show all posts

Monday, March 19, 2012

HELP ... select statment

Below is the query

It returnes the amount of products, the serial no and quanity

what i need to display in the results is alias column 'qty' only to display items

greater than 0

select name
, serialno
, sum(saleslead_product.quantity) as qty

from company
inner join saleslead on company.id = saleslead.company_id
inner join saleslead_product on saleslead.id = saleslead_product.saleslead_id
inner join product on saleslead_product.product_id = product.id

where name like 'test'

group by name
, serialno

You could add "HAVING sum(saleslead_product.quantity) > 0" at the end.|||

thanks.... been staring at the screen to long!!