Skip to content

Get top n counted rows in table within group [MySQL]

I’m trying to get just top 3 selling products grouped within categories (just top 3 products by occurrence in transactions (id) count(id) by each category). I was searching a lot for possible solution …

Pickeling results of postgresql query via psycopg2

I’m querying the PostgreSQL database via the psycopg2 library. The response of the query this way is cursor object file. Because of the size of the query, I’m trying to avoid re-query it and instead – …

Fetch data from Json array in rows and columns

I have this query to append the arrary in JSON: DECLARE @TheTable table(TheJSON nvarchar(max), Condition int ) DECLARE @mystring nvarchar(100)='{“id”: 3, “name”: “Three”}’ INSERT INTO @TheTable …

SQL Server substring throws error “multiple results”

I use Microsoft SQL Server 2016. I have a column that is called Failover and looks like his: I want that number so I use : It works fine, but if I want a second column called Account, it crashed with multiple results… How to fix this ? Is there a simple way to take the second number and third?