Question: FOR SQL users. How would I use this function to find a value. I want to find all the search results for New York with
FOR SQL users. How would I use this function to find a value. I want to find all the search results for New York with a given number_of_locations for the year at each of the IP_locations. What query would I use to specifically give me a sum of the number_of_locations for the year at the IP_locations for the state of New York. The following query returns a result but it is hard to determine.
SELECT CONCAT(s.state_code,' - ',s.state_name,' - ', w.city_name,' - ', w.IP) AS IP_location,
COUNT(*) AS number_of_locations,
EXTRACT(month FROM event_begin_time) AS month,
EXTRACT(year FROM event_begin_time) AS year
FROM census_data w
INNER JOIN state_data s ON w.state_code = s.state_code
GROUP BY IP_location, month, year
ORDER BY number_of_locations DESC
LIMIT 50;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
