There are 2 tables: the platform table with the user_id, id_platform and the setting table with the user_id(связь с таблицей platform), sound, animation, private fields user_id(связь с таблицей platform), sound, animation, private .

I get the data "id_platform" (there may be several) through GET. How can I make a request to select all private fields from the transferred users? Made such a request:

 $insert ="SELECT `user_id`,`private` FROM `platform`,`setting` WHERE `platform`.`id_platform` IN (".$list.") AND `setting`.`user_id`"; 

Tell me, please, how to?

  • Well, you almost finished writing a bit ... and platform.user_id=setting.user_id - Mike
  • @Mike need to add it to the very end, did I understand you correctly? - user206425 September
  • Well, setting.user_id you have already written there for some reason means to add to it =platform.user_id would not hurt at all on some sql-ex.ru and at least a little to understand sql, basic knowledge is acquired in a day - Mike
  • @Mike I will definitely use your advice. Thank. - user206425 September

1 answer 1

 $insert ="SELECT `platform`.`user_id`,`setting`.`private` FROM `platform` INNER JOIN `setting` ON `platform`.`user_id` = `setting`.`user_id` WHERE `platform`.`id_platform` IN (".$list.")"; 
  • I may be very stupid, but I do not understand what is there in "and so on." - user206425 September
  • @ user206425 where clause. I will correct then. - DanielOlivo
  • Thank you very much. - user206425 September