Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 23 days ago. Improve this question How can I divide two integers without using the / operator? Thank you so much for the help i…
Tag: sql
How to find the index of an element in an Array in BigQuery
is it possible to find the index of an element in a array in BigQuery? The idea is to find the index of an element to grab a different element in the row below. So for example, for this case I need to find the index of ‘status2’ to grab the respective entering date of the status after status2, tha…
Can’t JOIN on CTE column inside CTE, unknown column
I am trying to achieve the following… I get the following error: Why can’t I reference the relations table? Answer Based on your CTE, this is just a guess, but I think you probably want: We don’t know your table structures, so I can’t say I have the right columns for that join, but I&#…
syntax error at or near “INSERT” when creating a temp table and insert into a subquery–PostgreSQL Error
I created a temp table and insert into a subquery but I got an error saying ‘syntax error at or near “INSERT”‘. Can anyone have idea? Thanks! Answer Note that CREATE TABLE and INSERT INTO are two distinct statements. You need to insert a ; between them: I created a temp table Note that…
Database row wont update when my TRIGGER fires. — “#1242 – Subquery returns more than 1 row”
I want to insert a new row on table ‘b’ when a column in table ‘a’ is updated. But when the trigger fires with UPDATE REQ SET status=’approved’ WHERE idReq=1; it throws an error saying: “#1242 – Subquery returns more than 1 row” Note: I am using MariaDB 🙂 …
issues converting output from a view to json and array in snowflake using SQL
I am new to snowflake and have successfully created a view from a table using sql, but I am having issues creating a view that transforms the whole table into Json and array my view my_view output id town created_date updated_at Services 123 modak 2024-03-29 2024-03-29 [{ “service”: “green&#…
Pentaho Transpose column to rows
I have this table in Pentaho. I would like to have my data like this Is there a way to unpivot like this with Pentaho or perhaps a SQL query? Answer Yes, you could use SQL or Pentaho. With Pentaho you use the step Row denormaliser. To use the Row denormaliser, you need to previously sort your rows by the
Display the previous date for a user in an additional column
I have a list of users and a list of review dates corresponding to each user, the user can have multiple reviews relating to them. What I need to do is create an additional column that shows me the users previous review date, if they don’t have a previous review I need it to be null. An example of the
FULL OUTER JOIN (or UNION) on 2 tables
I’m facing a SQL request issue. I’m not a SQL expert and I would like to understand my mistakes. My use case is to get all records of the first table + records of the second table that are not present in the first table. I’ve got 2 tables like this : First table “T-Finance par jalon ZO…
Executing stored procedure via linked server through trigger
I have created a linked server on a SQL Server connecting to an Azure SQL datawarehouse. When I execute a stored procedure of SQL DW via SSMS as below, it is getting executed as expected. But when I try to have that stored procedure executed as a part of trigger definition And when I try to insert a record in…