August 27th, 2000, 10: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 28th, 2000, 12:01 AM
"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, 12:29 PM
If I may ask, what do the letters 'bttl' do?
August 29th, 2000, 11: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)