Skip to content

Arranging VARCHAR data into Columns in SQL

My data is in a SQL table in the following format (I have about 20 different answers per user_id): I would like to create a view in PostgreSQL where all the data is shown according to User ID Thank you! Answer It is great example of not relational data (the semantic depends on row number), although the data a…

Nested SQL.promise() callback in Javascript

I want to write a nested callback JavaScript in order to use the subsequent ID’s of the INSERT statements in the different SQL tables. My code looks as follows: However, when trying to run this with Node.js it says Error: Callback function is not available with promise clients. Do you have a solution to…

Simple sql script fails on execution

Below is a sample bash script and it seems to error out when i execute the bash. The sql works on its own but in a script oddly. Please advise JOB_RUNNING=’SELECT count(1) from gv b,gv a WHERE b.paddr = a.addr AND type=”’USER”’ AND b.status=”’ACTIVE”’ AND …

Get nvarchar records that were inserted as varchar

How can I get all values of an NVARCHAR column whose some of the values were accidently inserted without using the N prefix and so was replaced with ?, and then change those values into the correct form? For example, if I have the following: Output: I want to get what was originally ‘иытание2’ and…

join two sql table as column

i have two tables as below: firsttable id cat_id name 1 2 name_01 2 2 name_02 3 1 name_03 4 3 name_04 5 3 name_04 secondtable id name 1 cat_01 2 cat_02 3 cat_03 my question is how can i create below table result? id(secondtable) name(secondtable) count(firsttable) 1 cat_01 1 2 cat_02 2 3 cat_03 2 Answer