August 27th, 2000, 09:32 PM
Is there a method by which I can query a table feild and return 'representatives' of each peice of data? I may need to explain further, so let me give a basic example:
In my fictional musicdatabase table there are thousands of entries under the 'bandname' column. I want to perform a query that will list each unique artist, whether there is 100 instances or just a single entry.
This query would be printed to a list on the screen.
August 27th, 2000, 11:01 PM
"SELECT bandname, COUNT(*) as bttl FROM yourtablename GROUP BY bandname"
Then you can print both the bandname and how many entries there are for that band/artist.
From the day we're born, we're running out of time.
August 28th, 2000, 11:29 AM
If I may ask, what do the letters 'bttl' do?
August 29th, 2000, 10:21 PM
It's just an arbitrary name (short for band total) to use for the variable. With that select statement, you have two to use:
$bandname (the name of the band)
$bttl (the total entries for that band)