php - how to only show some of the fields in an INNER JOIN -


i have following results.. problem want 1 field balances table , 2 fields userinfo table... if replace * user,avatar error...

$result = mysql_query("select * userinfo inner join balances on userinfo.user        =       balances.user order balance desc,avatar"); if (!$result) { die("query show fields table failed"); 

i not know proper form , cant find anywhere

tia john

as user column exists in both joined tables userinfo , balances need prefix table name while accessing column

try

select userinfo.user, userinfo.avatar, balances.balance userinfo  inner join balances  on userinfo.user = balances.user  order balance desc,avatar 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -