mysql - Insert into with select and group by -


i try insert into select , group by, this:

insert client(name, age, last_name, id_city) select l.name_client, l.age_client, l.last_name, l.id_city list_request l  inner join product pd   on l.id = pd.id_list_request; 

when run it, 4 results appear, repeated, need one.

what can solve this, try use group by, not work, or don't know how use it.

edit: sorry, forgot 2 columns, need group name , age.

try

insert client(name, age) select    l.name_client,    l.age_client    list_request l     inner join product pd on      l.id = pd.id_list_request group   l.name_client,   l.age_client; 

if doesn't work can print out getting select , add question?


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -