Mysql sum on self table select
I'm looking for the right sql query to do the following operation: I need to display all record for today and for each make sum of price field for the curent user and date < today Table Commandes: (today =…
I'm looking for the right sql query to do the following operation: I need to display all record for today and for each make sum of price field for the curent user and date < today Table Commandes: (today =…
on mysql I see this error but can fix it. Anyone can help please? select * from ( (select a.* from sessions as a) join ( select b.customer_id, min(b.timestamp), b.marketing_source as first_touch_source, b.marketing_medium as first_touch_medium from sessions as b group…
I am using codeigniter 3 and when I uploaded data to my database, it didn't skip the duplicates. May someone please help me to address this problem? The code below is used to upload excel files. I'd like to skip…
I'm trying to use docker-compose to run a project with two Docker containers, MySQL and NodeJS. I'm having trouble connect to the SQL container from the backend container. My backend container uses Prisma as it's ORM and shows me the…
I have a social media app written in Flutter. Users can see the profiles each other and block/unblock them. I'm using MySQL to keep that data. Now I want to implement chat feature using Firebase Firestore (or maybe MongoDB). When…
I have a table with payment history payments: id consumer_id amount created_at 1 1 30 2021-05-11 13:01:36 2 1 -10 2021-05-12 14:01:36 3 1 -2.50 2021-05-13 13:01:36 4 1 -4.50 2021-05-14 13:01:36 5 1 20 2021-05-15 13:01:36 In final result…
I was looking for a workaround for configuring my database connection. I saw that opening 3306 port is dangerous and we should be using SSH Tunnel instead to connect to the database. I configured my MySQL server using docker and…
I have one query which return correct results for the parameters that are there but not what the goal is. There are two columns month and year. What I want is when I choose from dropdowns: 4/2020 to 12/2022 to…
I would like to filter my query with only closed months, so today (17/11/2022) would return only 31/10/2022 and before. I have tried the following: WHERE EXTRACT(MONTH FROM dc.data) <= (EXTRACT(MONTH FROM CURDATE()) - 1) So I get the current…
I have a single table with ~ 1.5 mio entries and this query: SELECT id FROM abc.items as I where revisit < '2022-11-17T00:00:00Z' AND type = 10 AND firstdelivery = ( select min(firstdelivery) from abc.items WHERE I.polizzennummer = polizzennummer )…