Skip to content

Tag: sql

Create and Run Query in Postgresql Procedure

I want to create a postgresql procedure which creates a query and run it. I tried and research on forums. But i can not solve my problem. Procedure should get user input as a parameter and use it in query. My code like that : And this is the error : edit: form_field is a table. create statement : Answer

Replacing case with IIF in SQL Server

So for my above query, I want to use IIF instead of CASE, because I want to show only uninsured patients, would something be correct? Because if I only use one case in my case scenario, the null will should up in my insurancestatus column instead of uninsured. Basically I just want the result for null showing…

Split array(bigint) to multiple rows of bigint

I’m querying some data (SQL, presto), each item can be the parent or child of another. The parent IDs and the child IDs are stored in the row for that primary ID as an array(bigint). Each task could be the child of multiple parents. It looks something like: I want a list of all of the parent Ids and eac…