PDA

View Full Version : access database......something or another and stuff...


Phip
10-02-2002, 10:46 PM
How would I do this?

If I have a database like this:

+-----------------------------+
| id | picName | album |
| 0 | blah blah | General |
| 1 | blah | Party |
| 3 | text | Party |
| 4 | ;kj;kj;kj;l | General |
| 5 | lijhlkjhlkj | Random |
+-----------------------------+

How would I have ASP go through and display one of each kind in album. Like:

General
Party
Random

Carl
10-02-2002, 11:07 PM
Hi,

Asuming you already have the SQL figured out do,

Do While Not recordSet.EOF
Response.Write(recordSet("album"))
Loop

Carl

Phip
10-02-2002, 11:32 PM
i got that figured out. but if i do a plain select it will put them all down:

general
party
party
general
random

i need only one of each.

Carl
10-02-2002, 11:39 PM
If you only want one record, simply take away the loop :)

Carl

whammy
10-03-2002, 12:16 AM
If you want to just cound the album categories DISTINCTLY, you'd use SQL's DISTINCT statement.

in SQL Server it's like:

SELECT DISTINCT(album) from tablename
in Access it's like:

SELECT DISTINCT album FROM tablename

Wait, that's the same... lol. Anyway if you want to do a distinct count, the SQL syntax is different in Access. :)

Phip
10-03-2002, 03:57 AM
... Actually:

strSQLPhoto = "SELECT album FROM photo_key GROUP BY album;"

Thanks for the help though. :)

whammy
10-04-2002, 04:19 AM
Ok, so you have it figured out? :)