Single-row subquery returns more than one row. This is the error that I get while running the following snowflake code. I am aware that it is because of the TO_VARCHAR function is not for a whole …
SQL – How to store JSON_QUERY output to variable
I have this query in which I’m trying to store the query output into @json variable but getting syntax error DECLARE @json NVARCHAR(MAX) SELECT @json = (JSON_QUERY((SELECT …
MYSQL – How to check if a column has value or is it null and another column has value like 10
Lets say i have a table with 3 columns id, user and status. I need to find rows which have status as 1 or null and user = ‘someName’ I am lookin for a condition like this: if (user == ‘name’ && status == 1 || status == null) How do i do this in mysql Answer Just: This can
reuse of subqueries with different WHERE clause
I have a query which I looks schematically like this WITH sub_base AS ( SELECT type, CASE WHEN a < 10 THEN 'GOOD' WHEN a BETWEEN 10 AND 100 THEN 'OK' ELSE 'BAD' END AS a_q, … CASE WHEN …
Print name of all activities with neither maximum nor minimum number of participants
How can i solve this question of hackerrank. I am quite confused an unable to move forward with this. here is what i have tried SELECT DISTINCT ACTIVITY FROM FRIENDS, SELECT max(ACTIVITY) AS M …
Unpivot rows into columns
I want to unpivot the a table, based on Case number: (see image for the formatted table) However, it is a large dataset, so I cannot put the value of every date in the unpivot function. Any help …
How to auto count previous 6 months annoucement record in SQL put in the separate box?
I have facing big problem to auto count previous 6 months annoucement record in SQL put in the separate box. Is using loop to count the annoucement record? Anyone can guide me or give me an example to …
How to select rows in a many-to-many relationship? (SQL)
I have a Students table and a Courses table. They have a many to many relationship between them and the StudentCourses table is the intermediary. Now, I have a list of Course ids and want to select …
Count number of results per CustomerID
I am looking into phone calls to customers and I need a column that count the results for previous calls to the same customer. E.g how many of the prior calls has ended with the result “No Contact” …
Azure LogicApp cannot get rowid from SQL Server
I have an Azure logicapp that connects to a SQL Server database in Azure. The table has a uniqueidentifier column as the primary key. In the logic app the delete or update requires the rowid in order to perform update, the primary key does not work here and throws an error when running, stating that the tableā¦