Skip to content

Instantly share code, notes, and snippets.

@ranafaraz
Created February 24, 2021 05:48
Show Gist options
  • Select an option

  • Save ranafaraz/a9f83f5bf160bbbf4aa152e446531e53 to your computer and use it in GitHub Desktop.

Select an option

Save ranafaraz/a9f83f5bf160bbbf4aa152e446531e53 to your computer and use it in GitHub Desktop.
Queries to get room and furniture details of IUB
SELECT
ep.title AS Equipment_Type,
e.title AS Equipment,
e.picture
FROM
equipments e
INNER JOIN equipements_type ep ON (( ep.id = e.type_id ))
GROUP BY
ep.title
ORDER BY
ep.title,
e.title
ASC
LIMIT 5
SELECT
c.title AS Campus,
b.building_title AS Building,
rt.room_type_title AS Room_Type,
CONCAT(r.room_number, ' - ', r.room_name) AS Room
FROM
buildings b
INNER JOIN campus c ON (( c.id = b.campus_id ))
INNER JOIN rooms r ON (( r.building_id ))
INNER JOIN room_types rt ON (( rt.room_type_id = r.room_type_id ))
GROUP BY
c.title,
b.building_title
ORDER BY
c.title,
b.building_title
ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment