Skip to content

Instantly share code, notes, and snippets.

@stefanosc
Created May 9, 2015 12:40
Show Gist options
  • Select an option

  • Save stefanosc/450af597047da83a07b8 to your computer and use it in GitHub Desktop.

Select an option

Save stefanosc/450af597047da83a07b8 to your computer and use it in GitHub Desktop.

Revisions

  1. Stefano Schiavi created this gist May 9, 2015.
    28 changes: 28 additions & 0 deletions gistfile1.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    SELECT e.album_id

    FROM jos_hwdms_media as m

    LEFT JOIN jos_hwdms_album_map e
    ON m.id = e.media_id

    LEFT JOIN jos_hwdms_category_map as h
    ON m.id = h.element_id

    LEFT JOIN jos_categories as cat
    ON cat.id = h.category_id

    LEFT JOIN jos_users as u1
    ON m.created_user_id = u1.id

    LEFT JOIN `jos_hwdms_users` AS u
    ON u.id = u1.id

    WHERE u.access IN (1,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,30)
    AND u.status = 1
    AND u.private = 0
    AND cat.published = 1
    AND (m.language = 'en-GB' || m.language = '*' )
    AND m.access IN (1,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,30)
    AND m.published = 1
    AND e.album_id!=''
    GROUP BY e.album_id