I have written a database with game stats, featuring winner, loser, and money won. I’m now trying to make stats for it. See database here I’m trying to make stats for these games, etc number of wins/…
Why I get division by zero for PostgreSQL v13? I suppose rows should be filtered out
Running same query on different versions of PostgreSQL gives different result. WITH t(a, b) AS (VALUES (1, 0)) SELECT a / b FROM t WHERE b 0; On v11.10 I get no rows as expected fiddle On …
Get users that made order every month from MySQL
This is my database table: orders id user_id order_id datetime 1 1 1245652 1607444387 2 2 3265784 1607357987 3 1 9521014 1607357927 4 3 1036951 1607317987 I want to have a list of users that …
Is there a way to order by value increase compared to older entries in MYSQL?
I want to order each ID by the percentage increase in a three day timeframe. If there is no entry three days ago, it should move up the date until today’s date. In the following I have explained the …
Polly retry policy with sql holding transaction open
I am using Polly to implement a retry policy for transient SQL errors. The issue is I need to wrap my db calls up in a transaction (because if any one fails, I want to rollback). This was easy before I implemented retry from Polly because I would just catch the exception and rollback. However, I am now using the
How to get first row of data for each month (postgres)
I am a beginner in postgres and would like to get the first row for each month (group by) but I’m not really sure how. My table order is as per below: order_id | cust_id | order_date ——————…
How to have different values of a single column in a condition where in sql?
I write a SQL query to get different sales information about stores. The problem is that I would like to filter and take only some store numbers in my “GL_ETABLISSEMENT” column, if I just do …
SQL statement in VBA Excel
I have a problem with a SQL Statement in VBA Excel. I can’t use ORDER BY together with GROUP BY and I don’t understand why. If I delete ORDER BY I don’t get errors. Can anyone help me figure out where am I wrong? Thanks a lot to everyone!! Here is my code: Answer missing space ? try with
SQL Sorted Count
I have the following table sorted by date: date id 9/1/20 1 9/1/20 2 9/3/20 1 9/4/20 3 9/4/20 2 9/6/20 1 I’d like to add a count column for each id so that the first count for each id is the earliest date and latest date would receive the highest count for each id: date id count 9/1/20 1
AVG in SQL Server
I am learning SQL Server, and I have a sample database which I got from my co-worker. I created a stored procedure previously which works fine. Now I am trying to show average of the column which I am struggling at the moment. Your supports means a lot and I will learn from this. So here is my query: And