Interview Question in SQL Server Indexing


 

Interview Question :: PHP: different tables, same column name problem


Here is my SQL statement:

"SELECT albums.title, albums.ID, artists.title, artists.ID FROM albums, artists WHERE albums.artistID = artists.ID "

when i echo this: $row_randAlbQuery['albums.ID'];

i get this error:

Notice: Undefined index: albums.ID in C:\sites\premium18\purposebuilt\webroot\... on line 166

any idea why? is there a way of doing it without using AS everwhere?
Answers to "PHP: different tables, same column name problem"
RE: PHP: different tables, same column name problem?

"SELECT albums.title alb_title, albums.ID alb_id, artists.title art_tit, artists.ID art_id FROM albums, artists WHERE albums.artistID = artists.ID "



and use echo $row_randAlbQuery['alb_title']...etc.
 
Vote for this answer ::  
Update Alert Setting