Skip to content

Tag: sql

pivot table with multiple value columns in postgres

I need a query which will help me to get data as described below I have a table as followed ID date STATUS TIME09_10 TIME10_11 TIME11_12 TIME12_13 1 2021-09-01 RUN 30 60 45 0 2 2021-09-01 WALK 15 0 o 30 3 2021-09-01 STOP 15 0 15 30 I want this data to be in below format. From the above

How to query this in raw SQL?

I have a table user with 2 columns, name and role. I want to group together for one role all the names which are associated with it. So suppose for the role “admin” is used by 3 different names. I want to start my query with this Answer listagg function should help. need to group the column contai…

Return the Data from Column Using PowerShell

When I export the $dt to a CSV – it shows in 1.A of Excel = 1 and in 2.A = 2. I need to extract the two value of the second row in column A. First why is the count working? And why do I not get a return for the values in the last two echo commands when

Importing .bak MySQL database with Python using pymssql

The title is pretty self explanotory. I’ve tried the following code : But I get the following error : No module named ‘_mssql’. I have the version 2.2.2 of pymssql and I use Python 3.9. I’m just trying to write and read from this database, and I only have the .bak file. I’m quite…

Create index with multiple columns

How can I create index with multile columns in liquibase yaml. I was trying to do something like that: But I am getting error column ‘name’ is required for all columns in an index. I saw similar questions, but answers/examples was written in xml and it was not working for me. Answer Above worked f…