Skip to content

Tag: postgresql

Postgres join and count multiple relational tables

I want to join the 2 tables to the first table and group by a vendor name. I have three tables listed below. Vendors Table VendorOrders Table OrdersIssues Table The expected output is to count how many orders belong to a vendor and how many issues belongs to a vendor order. I have the below code but it’…

SQL Query for max value from subsets

I have a table bls_jobs with the following columns: city, state, occ_title, jobs_1000, and loc_quotient I am trying to retrieve the highest loc_quotient for each city (each city has several occ_titles, and each occ_title has a loc_quotient) Currently, I can use this query: Which does return what I’m loo…