Skip to content
Advertisement

Tag: database

SQL Filter by dateTime

day is a integer variable. If I set the day value to 1, database is filtering for 24 hours. But if I set the day value to 1, I only want to see the logs of the new day. How can I do that? Thank you for your help. Answer

Count from 4 tables with join and null values

Tables: What I am expecting to query is this: However this is what I get: With this query: I wonder, in what way the query above could be modified to return the expected results? What would be a good approach to achieve this? Answer You are joining along two dimensions, so you are getting a Cartesian products. That is simply

How can I show values with zero in a Group By query

I am trying to get the zero values from my status table associated with the case of one user. So, I have this query that returns me only one value because, I have only one case associated with one status but I want to receive also the another status with value 0. So I have the status ‘Open’ and ‘Closed’

SQL Query creation with multiple joins

I am working with MYSQL, and want to create a query. I have 3 tables. QUESTION QUESTION_NUMBER QUESTION_DESCRIPTION 1 anydesc 2 anydesc2 ANSWER ANSWER_NUMBER ANSWER_DESCRIPTION 1 anydescANS 2 anydesc2ANS 3 anydesc3ANS And a bridge TABLE QUESTION_ANSWER Q_NUM A_NUM 1 1 2 2 2 3 Now I want to retrieve all the Answers of let’s say a specific QUESTION NUMBER i.e

GROUP BY with Key:Value filters for each group

Given a table with following schema: RecordId ProcessId Data 80830F00-379C-11EA-96B7-372060281AFC 1 4.2 80830F00-379C-11EA-96B7-372060281AFC 2 445588662211448 80830F00-379C-11EA-96B7-372060281AFC 7 1 791F6D30-379C-11EA-96B7-372060281AFC 1 3.3 791F6D30-379C-11EA-96B7-372060281AFC 2 999999999999999 791F6D30-379C-11EA-96B7-372060281AFC 7 2 So the RecordId represents some grouping key and each ProcessId has its Data. Now I have a filter which looks like this: So the key is ProcessId and value is Data. Question How

Advertisement