0

Here is my query

 UPDATE tracks 
    SET People_id_Reference = (SELECT People_id 
                               FROM People 
                               RIGHT JOIN top100 
                               ON 
                               People_name=top100.artist LIMIT 1) 
                               WHERE People_id_Reference IS NULL;

But that query inserts same people_id value into all rows of People_id_reference Can some on help me with this. Thanks in advance

2
Contributors
2
Replies
5
Views
4 Years
Discussion Span
Last Post by andarivaadu1
0

what is ur table structure and what is ur purpose(what u want to update with what value)?

Only query is not enough to understand your problem.

0

So My tables are

People: People_name(VARCHAR 100), People_id (INT, PRIMARY KEY AUTO INCREMENT) 

Tracks: Track_id(INT PRIMARY KEY), People_id_references (int ,Foreign key references People(people_id)), Track_title(VARCHAR 100)

top100:(artist varchar(100), id(int, primary key), track_title(varchar100);

All the columns in above tables are having values, except in people_id_references(this is in tracks table). top100 has many other columns, but for clarity sake I did not mention them, and it is now way connected to people or tracks table. The data from top100 is present in track and people table, this is done using some insert queries.I want to import values from people_id (it is in People table).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.