SELECT 
  PI.product_id, 
  F1.id AS file_id, 
  F1.path AS file, 
  (
    SELECT 
      PI1.alt 
    FROM 
      `cscart_products__images` PI1 
    WHERE 
      PI1.original_file_id = F1.id
  ) AS file_alt, 
  F2.id AS big_file_id, 
  F2.path AS big_file, 
  (
    SELECT 
      PI2.alt 
    FROM 
      `cscart_products__images` PI2 
    WHERE 
      PI2.watermark_big_file_id = F2.id
  ) AS big_file_alt, 
  F3.id AS small_file_id, 
  F3.path AS small_file, 
  (
    SELECT 
      PI3.alt 
    FROM 
      `cscart_products__images` PI3 
    WHERE 
      PI3.watermark_small_file_id = F3.id
  ) AS small_file_alt 
FROM 
  `cscart_products__images` AS `PI` 
  LEFT JOIN `files` AS `F1` ON `F1`.`id` = `PI`.`original_file_id` 
  LEFT JOIN `files` AS `F2` ON `F2`.`id` = `PI`.`watermark_big_file_id` 
  LEFT JOIN `files` AS `F3` ON `F3`.`id` = `PI`.`watermark_small_file_id` 
WHERE 
  `PI`.`product_id` = 30253

Query time 0.00110

Result

product_id file_id file file_alt big_file_id big_file big_file_alt small_file_id small_file small_file_alt
30253 367523 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_755ec09f432f_30254_030095af6b77_0_9ec508d6e314_IMG_4564.JPG 367525 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_1b7b51b3e4af_30254_030095af6b77_0_9ec508d6e314_IMG_4564.webp 367526 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_5889023f923c_30254_030095af6b77_0_9ec508d6e314_IMG_4564.webp
30253 367527 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_194d8585fefc_30254_e8d5e4685091_0_093d4fd1e698_IMG_4559.JPG 367528 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_7ae508db6347_30254_e8d5e4685091_0_093d4fd1e698_IMG_4559.webp 367529 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_f94880e0fc5c_30254_e8d5e4685091_0_093d4fd1e698_IMG_4559.webp
30253 367530 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_2d6341ef2f81_30254_82c5370a6358_0_6ad98424e8ef_IMG_4558.JPG 367531 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_ce847b77a188_30254_82c5370a6358_0_6ad98424e8ef_IMG_4558.webp 367532 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_53506a914c8f_30254_82c5370a6358_0_6ad98424e8ef_IMG_4558.webp
30253 367533 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_7897725d436a_30254_25443b0561e3_0_13255866a65c_IMG_4562.JPG 367534 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_8ac539cddf60_30254_25443b0561e3_0_13255866a65c_IMG_4562.webp 367535 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_d6c5c5c1fa01_30254_25443b0561e3_0_13255866a65c_IMG_4562.webp
30253 367536 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_5579efe089f3_30254_8944f4648baf_0_399a69020734_IMG_4563.JPG 367537 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_427c7310950d_30254_8944f4648baf_0_399a69020734_IMG_4563.webp 367538 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_dfbc6af8056a_30254_8944f4648baf_0_399a69020734_IMG_4563.webp
30253 367539 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_c0b7bbbe3509_30254_86e73316b83d_0_e71c37b3f607_IMG_4561.JPG 367540 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_f1ff2a666c97_30254_86e73316b83d_0_e71c37b3f607_IMG_4561.webp 367541 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_f004b8f6784a_30254_86e73316b83d_0_e71c37b3f607_IMG_4561.webp
30253 367542 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_631ba31020ed_30254_ad44cfe285b4_0_2d5d5ae49d73_IMG_4566.JPG 367543 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_4c5ae3c365e9_30254_ad44cfe285b4_0_2d5d5ae49d73_IMG_4566.webp 367544 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_3aefe8ba9648_30254_ad44cfe285b4_0_2d5d5ae49d73_IMG_4566.webp
30253 367545 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_192fde6984ff_30254_fad5a9bbb232_0_e363db966b8a_IMG_4560.JPG 367546 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_71c2c5e7d63b_30254_fad5a9bbb232_0_e363db966b8a_IMG_4560.webp 367547 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_4f458a21ef7e_30254_fad5a9bbb232_0_e363db966b8a_IMG_4560.webp
30253 367548 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_a54ea03a2871_30254_ebeca56b35f7_0_f232e5324486_IMG_4565.JPG 367549 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_967d3c7eedac_30254_ebeca56b35f7_0_f232e5324486_IMG_4565.webp 367550 https://s3.timeweb.cloud/482029f9-prod/products__images/30253_d5486ab7aff2_30254_ebeca56b35f7_0_f232e5324486_IMG_4565.webp