I am looking to use an array of values in the WHERE IN condition. After research, I saw that I had to make a “CREATE TYPE”, since a “TYPE” in local does not work. This solution does not suit me, I do not want to make a new TYPE in Oracle, since the database is used for an ERP/PGI I
Tag: sql
EXPRESS and SQL “syntax error at or near “$””
I’m making PFP route with EXPRESS and PSQL and I have a little problem. I get an error Syntax error at or near “$” Code: I think there shouldn’t be any problem? Thanks. Answer You just made typo when indicated 1$ instead of $1:
TSQL CTE error ”Types don’t match between the anchor and the recursive part”
Would someone help me understand the details of the error below..? This is for SQL Server 2008. I did fix it myself, and found many search hits which show the same fix, but none explain WHY this happens in a CTE. Types don’t match between the anchor and the recursive part in column “txt” of …
Select second most recent date from inner join
I have this query : I get this result : How can I select only the second most recent created_at date from each unique display_name ? Answer You could use row_number to assign a sequence to your dates and apply this before joining, then include as part of your join criteria, such as: You could also apply this …
Concatenate values of two consecutive rows SQL
I want to write a SQL query to concatenate row values of 2 consecutive rows as described below: I have the below table: I want to have another column as below: The concat value is the concatenation of serial_no value in row 2 with the serial_no value is row 1, serial_no value in row 3 with the serial_no value…
SQL Two joins; First one a left join; second only join when combination does not exist yet
I have the following problem. I have the following 3 tables, I can’t edit those. I have a “main” table I would like to join “Table1” to, I succeeded (see fiddle). The next step is to join “Table2”, but only when the Charge-Name combination does not exist yet. If it doesn’t exists…
SQL help i need to find the inventory remaining in my office (i want to know unallocated asset remaining ))
In sql help i have 2 tables, table one is asset table which is as follow id asset_code asset_name asset_group asset_quantity 1 A001 demo asset 4 5 2 A002 demo asset 2 6 3 and another table is asset_allocation id asset_id allocated_quantity allocated_location 1 1 2 IT office 2 1 1 main hall now the scenario is…
SQL Server : how to group only part of the syntax
I have a problem creating a SQL Server query. In summary, the query should get columns that are sum and count, grouped by customerID, and another column that is a case when by a column that is not used as a grouper column. My problem is to group only part of the syntax, while the case when column does not
Hierarchy Queries in BigQuery
I have a data from ControlM (scheduler) this way I saw many solutions where they have started from first node and descended to last node. But that is likely to fan-out with this data. What I am looking for a fan-in solution, where I can start with any end node and come towards first node In this case the answ…
Map fiscal years using a date column from one table and taking start and end date from another table
I have two tables in SQL Server. The first table contains a Date column. The second table contains start date and end date for various fiscal years and another column denoting fiscal years (that goes like fy21, fy22, and so on). I want to map the Date in table 1 to the FYs in the second table by checking if