The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Non-VB query...
I'm trying to knock up a relatively simple script for accessing a database to pull out the Artist and Title of an album ... but there is a small issue of the fact that these are stored in tables which have 1 entry for each track (so it could effectively be 15 entries for the same Artist/Album). I've been trying to figure out how to pull both of these, but only once for unique results (I did use DISTINCT but it only apparently works on one column).
Here is the code I have at present: PHP Code:
What I basically need it to do is display one album title, even if there are 15 entries in the table, then if it finds any blank entries, discount them. Hope this made some sense! Jase |
#2
|
||||
|
||||
put a group by in there.
SELECT album, artist, max(date_added) as 'date_added' FROM samdb.songlist group by album,artist ORDER BY date_added DESC LIMIT 10") Not sure how there can be blank entires though. That's a badly un-normalised data structure. artist_table artist_id name birthdate favourite_color album_table artist_id album_id album_name other_album_data track table album_id track_name track_length |
#3
|
||||
|
||||
Quote:
I do agree it's badly formatted in the database, I'm working on tidying this lot up! Thanks for your help, Jason |
#4
|
||||
|
||||
Ok, I've moved away from that issue now, there's no point trying to do all of that as I released some albums have multiple artists.
Next issue though .... PHP Code:
Cheers! Jason |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|