Copy link to clipboard
Copied
Hello,
I have a database "choir" with the table "members" which has the following data structure:
| Name | Voice |
|---|---|
| Jenna | soprano |
| Danna | alto |
| Roxy | alto |
| Damien | tenor |
| Carmen | alto |
| Daisy | soprano |
Diana | alto |
| Robert | tenor |
| John | bass |
With Dreamweaver php, any help me on how can I display in a webpage the total number of "alto", in this case: 4.
Thanks,
Luci.
SELECT voice, COUNT(*) as voice FROM choir GROUP BY voice ORDER BY voice DESC;
This will give you plain voiceid - count
SELECT voice, COUNT(*) as name FROM choir GROUP BY voice ORDER BY voice DESC;
This will give you name - voice - count
Trust it helps.
Cheers,
ST
Copy link to clipboard
Copied
Create a new Recordset in Dreamweaver and run the following SQL:
SELECT voice, count(voice) AS voiceCount FROM choir GROUP BY voice
Copy link to clipboard
Copied
Hi,
Thanks for your fast reply. I've used your proposal and it works fine.
However, I get only the value 4.
What I would like is:
alto 4
bass 1
soprano 2
tenor 2
Any help on how can I achieve this?
Thank you very much?
Copy link to clipboard
Copied
SELECT voice, COUNT(*) as voice FROM choir GROUP BY voice ORDER BY voice DESC;
This will give you plain voiceid - count
SELECT voice, COUNT(*) as name FROM choir GROUP BY voice ORDER BY voice DESC;
This will give you name - voice - count
Trust it helps.
Cheers,
ST
Copy link to clipboard
Copied
Thank you very much. This is what I wanted.
I have also another harder request. I've put it separately.
If you could help me on that too, I would be higly appreciating.
Thanks!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now