# Masjid



## get banners by specified scope
```sql
SELECT
    banner_masjid.masjid_id,
    GROUP_CONCAT(banners.image) as "image"
FROM
    banners,
    banner_masjid,
    masjids
WHERE
    banner_masjid.masjid_id = 1
    AND banner_masjid.banner_id = banners.id
    AND banner_masjid.masjid_id = masjids.id
GROUP BY
    banner_masjid.masjid_id;
```
## get user phone with joined masjid count 
```sql
SELECT
    users.phone,
    COUNT(masjid_user.id) 'count'
FROM users, masjid_user
WHERE
    users.id = masjid_user.user_id
GROUP BY masjid_user.user_id;
```