![]() |
| ||
| Using the COUNT function with a subquery in SQL Hi I'm having trouble with a subquery and really need some help. I'm trying to count to count the number of beats sold by a particular producer. So the first thing I did was SELECT all the beats sold by that producer so I wrote the code
'p_staffid' is the id number for the particular producer and the 'production_no' is the primary key for the beat itself. I have tested this code and it works perfectly. But how do I count the results? |
| ||
| Re: Using the COUNT function with a subquery in SQL The COUNT function will return the number of rows returned by the query which is what I think you are trying to do. The COUNT function requires a column to count as a parameter, so your query will look something like this: select COUNT(name) as number_sold |
| All times are GMT -4. The time now is 1:59 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC