Album Table
+----------------------------+
| id name updated_at|
+----------------------------+
Album_member table
+------------------------------------+
| id album_id member_id |
+------------------------------------+
Album_media table
+--------------------------------+
| id album_id link |
+--------------------------------+
My Query
$limit = 30;
$member_id = 1;
SELECT a . *,
(SELECT GROUP_CONCAT(CONCAT('$assets/album_image/medium/', ds_album_media.link) SEPARATOR ',') as link
FROM ds_album_media WHERE ds_album_media.album_id = a.id ORDER BY a.updated_at desc LIMIT 0 , 5)
AS photo_link FROM `ds_album` a
LEFT JOIN ds_album_media amd ON amd.album_id = a.id
LEFT JOIN ds_album_member amb ON amb.album_id = a.id
where amb.member_id = " . $member_id . " GROUP BY a.id
ORDER BY a.updated_at desc LIMIT 0 , $limit
Now for each album there is multiple album_media and album_member is for which album user is following i want data in such a way that retrieve all album that use follows and all photos of that album but constrains is that need to set album_media limit 5 and album limit 30.
1> limit not working as group_concat i have used any other way...??
2> i am using laravel so any solution regarding that are most welcome.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire