How could I convert this into this?
Convert oid to json as int instead of string
Using Postgres 12, the following will return an int JSON representation: > SELECT to_json(2::int) .. 2 Whereas if the type is oid, it will return it as string: > SELECT to_json(2::oid) .. “…
Error in SQL syntax [function in node-red]
I’m trying to post the data into database through node-red but I got this error. “Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘insert into customizations(custom_id, product_id, pa…
How can I output text until it is ascii in SQL?
How can I output text until it is ascii in SQL? Here is what I am trying to do: But in the end I am getting an empty string. Why? What am I missing here? I am expecting the value of the @output to be ‘text’ in the end of the script. UPDATE If I update the script to the
How do i transpose and grouping in PL/SQL [ORACLE]
I have this table: USER DEP USER1 DEP1 USER2 DEP2 USER3 DEP2 USER4 DEP3 But i want to transpose it and group user under DEP. DEP1 DEP2 DEP3 USER1 USER2 USER4 USER3 NULL NULL What i have tried following pivot query. The output is: 00933. 00000 – “SQL command not properly ended”. How do i use …
Fix duplicate rows while selecting nested fields from BigQuery using JOIN and UNNEST
I am trying to copy data from one BQ table to another and having trouble with un-nesting and JOINs. I have two fields of REPEATED RECORD type in my schema and when I try to JOIN those, I get a lot of duplicate rows. Here´s my query: What I want to achieve is: But when I JOIN Address and Work,
Get suppliers that doesn’t belong to a category in another table
I’m looking for a query where I need to show all the Suppliers from the Suppliers table that doesn’t have products from category 1 (Products.CategoryID = 1). Whenever I run it it always gives an error. Side question: How do I get these results but with suppliers that has products from cat. 6 ? (So…
Put a json inside another json on Oracle 19
i have the next problem. I need create a json from a table that contain another json inside in one of the columns Having this: i try with this query: But the result is not correct: Must be something like: There is a way to get the correct result? Regards. Answer after see examples and see the resuslts. I know
Full Join on two tables with criteria on both
I have two tables with a matching key. Some records exist on both tables, others only exist on one or the other. What I cannot for the life of me figure out is how to add criteria to both tables when …
Dynamic Case Expression Based on Dates
I have a SQL query that has multiple conditions that will change the WHERE clause. I have three case expressions that dynamically update this WHERE clause. The last two case expressions are working …