19 | | b.business_id, |
20 | | b.business_name, |
21 | | ( |
22 | | select avg(r.review_stars) |
23 | | from review r |
24 | | where r.business_id = b.business_id |
25 | | ) as business_avg_stars, |
26 | | c.category_id, |
27 | | c.category_name, |
28 | | ( |
29 | | select string_agg(a.address_city, '; ') as address_city |
30 | | from address a |
31 | | where a.business_id = b.business_id |
32 | | ) as address_city |
33 | | from business b |
34 | | join category c on |
35 | | b.category_id = c.category_id |
36 | | order by b.business_name |
| 19 | b.business_id, |
| 20 | b.business_name, |
| 21 | ( |
| 22 | select |
| 23 | avg(r.review_stars) |
| 24 | from |
| 25 | review r |
| 26 | where |
| 27 | r.business_id = b.business_id |
| 28 | ) as business_avg_stars, |
| 29 | c.category_id, |
| 30 | c.category_name, |
| 31 | ( |
| 32 | select |
| 33 | string_agg(a.address_city, '; ') as address_city |
| 34 | from |
| 35 | address a |
| 36 | where |
| 37 | a.business_id = b.business_id |
| 38 | ) as address_city |
| 39 | from |
| 40 | business b |
| 41 | join category c on |
| 42 | b.category_id = c.category_id |
| 43 | order by |
| 44 | b.business_name |