table name - city
columns -city_id,city_name
table - state
column -state_id,state_name
table name - category
column name - category_id,category_name
table name - news
column name - cat_id,state_id,city_id,headline,story ,author etc..
I nedd to select all column from city,state,and category table for inserting id in news table....
for that I create sql query and join all above three table but this shows error ..plz help me...
Column 'state_id' in field list is ambiguous
Column 'city_id' in field list is ambiguous
Column 'category_id' in field list is ambiguous
I need to return all columns from city,state and category table
SELECT city_name,city_id,state_id,category_id,state_name,category_name,headline,author,story,source,photo,date from news left join
city on news.city_id=city.city_id left join state on news.state_id=state.state_id left join category on news.cat_id=category.category_id;