Excuse me for this but I am tired =p

Aleashia

Registered User.
Local time
Today, 01:45
Joined
Jan 4, 2007
Messages
15
Hey everybody,

I know I can do this and I know it is something simple but I have been coding websites and such since 7am this morning and when I came to do this my mind went blank.

I am wanting to count how many licenses (the format is tick boxes hence the WHERE licentie=true) there are for a specific piece of software for instance:

Softwarenaam Licentie
Word 6
Excel 4

This is what I have:

SELECT DISTINCT s.Softwarenaam, (SELECT COUNT(Licentie) FROM Software WHERE Licentie= True) AS Licenties
FROM Software AS s;

It works except the count counts all the licenses and displays that for every piece of software as shown:

Word 10
Excel 10

I am sure it is something simple I am just missing. Thanks to anyone who can offer help on this and sorry for the Dutch data =)
 
Try:
SELECT s.Softwarenaam, Count(*) as Licenties from Software Where Licentie = True Group By s.Softwarenaam
 
Nope that doesn't seem to work either =(
 
Then there must be something else going on, or it is more complicated then you posted.
 
I agree your SQL should have done the trick.
 
I got it working, your sql was fine I just needed to add in an 's' for the alias on the table and it worked:

SELECT s.Softwarenaam, Count(*) as Licenties from Software s Where Licentie = True Group By s.Softwarenaam

Thankyou =)
 

Users who are viewing this thread

Back
Top Bottom