0

这是我的查询导致重复,有些表具有多个具有相同 ID 的值,例如奖项、流派、混音、gallery_to_images。为了删除这些重复项,我只使用了一行来分组,并且我的数据被截断,例如:从 2 张图像中,一张图像即将到来。这个有什么解决方法!!!!!!!!!

SELECT fm_films.id AS verticals_id,
       fm_films.NAME,
       fm_film_types.id,
       fm_films.STATUS,
       fm_films.film_type,
       fm_film_details.budget,
       fm_film_details.gross,
       fm_film_types.id AS film_typesid,
       fm_film_to_industry.industry_id AS industry_id,
       fm_film_to_language.language_id,
       fm_film_details.length,
       fm_film_details.movie_type,
       fm_film_details.release_date,
       fm_film_details.country,
       fm_film_details.STATE,
       fm_film_details.city,
       fm_film_to_genre.genre_id,
       fm_film_to_awards.award_id,
       fm_film_to_soundmix.soundmix_id,
       fm_film_to_cast_and_crew.cast_crew_id,
       fm_film_to_cast_and_crew.ROLE,
       fm_film_details.certification_id,
       fm_film_details.currency_id,
       fm_films.STATUS,
       fm_film_details.opening_weekend,
       fm_gallery_to_images.filename,
       fm_gallery_to_images.alt,
       fm_gallery_to_images.caption,
       fm_gallery_to_images.PRIMARY,
       fm_film_details.aspect_ratio,
       fm_films.description
  FROM (`fm_films`)
  LEFT JOIN `fm_film_types` 
         ON `fm_film_types`.`id` = `fm_films`.`film_type`
 INNER JOIN `fm_film_details` 
         ON `fm_film_details`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_film_to_language` 
          ON `fm_film_to_language`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_film_to_industry` 
         ON `fm_film_to_industry`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_film_to_genre` 
         ON `fm_film_to_genre`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_film_to_awards` 
         ON `fm_film_to_awards`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_film_to_soundmix` 
         ON `fm_film_to_soundmix`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_film_to_cast_and_crew` 
         ON `fm_film_to_cast_and_crew`.`film_id` = `fm_films`.`id`
  LEFT JOIN `fm_gallery` 
         ON `fm_gallery`.`object_id` = `fm_films`.`id`
  LEFT JOIN `fm_gallery_to_images` 
         ON `fm_gallery_to_images`.`gallery_id` = `fm_gallery`.`id`
  LEFT JOIN `fm_gallery_types` 
         ON `fm_gallery_types`.`id` = `fm_gallery`.`gallery_type`
 WHERE `fm_films`.`id` = '18'

下面是示例结果

18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   16  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   16  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   16  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   16  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   18  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   18  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   18  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   1   18  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   16  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   16  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   16  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   16  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   18  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   18  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   18  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   10  6   3   18  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   16  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   16  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   16  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   16  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   18  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   18  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   18  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   1   18  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   3   16  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   3   16  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   3   16  0   7   1   1   250000  www.facebook.com/test   NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   3   16  0   7   1   1   250000  www.youtube.com/test    NULL    NULL    NULL    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   3   18  0   7   1   1   250000  78ac009475b64c4ee15928c7b2e5d047.jpg            87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
18  Satyagrah   1   1   1   4000000 10000000    1   NULL    1   20:50   color   2013-09-16  1   1   1   8   6   3   18  0   7   1   1   250000  87cd0d032d9ded535f6c17f762f01c59.jpeg           87cd0d032d9ded535f6c17f762f01c59    1:4:2   this si the test
4

0 回答 0