Skip to content

Tag: mysql

SQL query for last 365 days report

I have a reports table with the following structure : I want a SQL Query to get the report for the last 365 days by following conditions : Group dates if the same date is repeated. The days which the report is not available for the last 365 days, I need those days added to the result rows with 0

Daily User Retention for a month mySQL

I have log_event table and which has table as shown below: db<>fiddle I wanted Daily user retention(day-1) for Aug’18. Day-1 retention: Users who registered on day-0 and then opened app on day-1. For ex: In short users who registered on like 15th Aug 2018 and opened app on 16th Aug 2018 Answer You…

SQL – Group records together based on value

Currently I have a table with the following values: I would like a resulting SELECT to return the below: eg. The timestamp is grouped by a duplicate some_id Is this possible with SQL? Answer This appears to be just a simple aggregation,

Select and join with sequelize

How to make this code with the sequelize? I used include, but it brings all the user data but I only need the name my code: Answer If you just want to reduce User model attributes then just indicate needed attributes in the attributes option: If you want to add a user’s name as a string prop at the same