Code: Select all
2022-03-17 02:43:30 : Mysql error 1052: Column 'gallery_id' in field list is ambiguous (SELECT SQL_CALC_FOUND_ROWS gs.gallery_id, gs.thumb_id, gi.sponsor_id, gi.content_count, gi.content_type, gs.total_shows, gs.total_clicks, gs.total_ctr, gt.thumb_url, gd.*, gi.content_count, gi.crop_profile_id, gs.activation_date, gi.added_date, gi.duration, gi.url, gi.gallery_total_shows, gi.sponsor_id, gi.source_url, gi.custom_gallery , comments_total FROM rot_gallery_stats1 as gs JOIN rot_gallery_info as gi on gi.gallery_id = gs.gallery_id
JOIN rot_gallery_data1 as gd on gd.gallery_id = gs.gallery_id
LEFT JOIN
( SELECT gallery_id, COUNT(*) as comments_total FROM rot_comments join rot_gal2model as g2m on gi.gallery_id = g2m.gallery_id WHERE comment_type = 'comment' group by gallery_id ) as tbl_count_comments
ON tbl_count_comments.gallery_id = gi.gallery_id JOIN rot_thumbs as gt on gt.thumb_id = gs.thumb_id
WHERE 1 = 1 AND gi.gallery_status = 'active' AND gi.gallery_type = 0 and gs.best_thumb = 'yes' and gs.group_id = 0 and g2m.model_id IN (1672) ORDER BY comments_total DESC LIMIT 0, 96# queryitems) 






