Skip to content

Tag: mysql

SQL query to find the concurrent sessions based on start and end time

Below is a sample dataset showing TV sessions of each TV set of each household. Household “111” switch on their TV “1” at 500 and switch it off at 570. However, this has been captured in the data as 2 separate rows. You will have to write a query to convert this into a single row. Similar modification needs t…

Sort MySQL query with multiple joined tables

My query uses left join to fetch multiple values from the table objects_values. I’m having trouble sorting the results the way I want; if ASC, then show the objects with the lowest attribute values first, and if DESC, show the objects with the highest attribute values first. I have actually managed to g…