Skip to content

Tag: sql

PostgreSQL verify an empty array on json

I have the following row on select I have to Identify empty jsons, then manually add a value to it (eg row 1 and 3 ), I tried the following : But the “is null” verification fails for this type of data (array of json), how to identify ‘[]’ values in this case? Note: I only have select p…

Group SAS rows based on conditions

I am new to SAS community and need your help for one of my analysis. I have a table like below: ID VAR Group Breach Month 1 A 1 202001 2 A 1 202002 3 A 1 202003 4 A 1 202004 5 A 1 202005 6 A 1 202006 7 A 0 202007 8 A 1 202008 9 A

stack or union multiple fields in MS Access

Beginner’s question here… I have a table of tree measurements being 3 fields: – ID, Diameter_1, Diameter_2 & I wish to get to these 3 fields: – ID, DiameterName, DiameterMeasurement Input and Desired Output Though it results in only 2 fields. How may the field: – DiameterMeas…

How to insert data into table even if trigger fails?

Oracle 11.1 I have custom logging table where I insert data: I have a trigger that runs on a specific table which does some checkings. My problem is: when the trigger fails, I want to be able to log some data into the log_table. Trigger: The following code doesn’t work. I tried to use EXECUTE IMMEDIATE …

How to add split between duplicate value in SQL

I have SQL Server table that have duplicated value in field and need to split by slash character. All field start with alphabetical char end with ‘M’ char For example: and need to convert to: Thanks Answer Probably many ways to skin this cat, assuming you’re always looking for the same initi…

How to sum rows in groups of 3?

I have a table that looks like this: I need a query that returns the summed amount of rows grouped by every 3 consequent IDs. The result should be: In my table, you can assume IDs are always consequent. So there can’t be a 10 without existing a 9 too. But the same ID can also show up multiple times