I am trying to break down a given number into 10 equal parts and then compare a row of numbers and see in which of the 10 parts they fall under. ref_number, number_to_check 70, 34 70, 44 70, 14 70, 24 …
PostgreSQL: Numeric field overflow on decimal / numeric Data Type – Why does it gives this Error
I create a table like this CREATE TABLE foo ( id serial CONSTRAINT id_pk PRIMARY KEY, bar varchar(256), test decimal(5,5) ); I then want to populate the test column INSERT INTO foo (test)…
query that add summary rows on invoice table (summary by single invoice )
Hi and thanks in advance to who will answer the following question: is it possible to have a SQL query that add 2 summary rows on invoice table, at the single invoice level? 1st row to add = discount (…
How to use left join with for json path in mssql?
When I use left join with for json path I get an error: Property ‘product_id’ cannot be generated in JSON output due to a conflict with another column name or alias. Use different names and aliases …
Updating multiple rows for user – Setting 1 row as “Default” Yes, and other to be No
Lets assume the following data selected from SQL TBL_Profiles: No User Profile Default 1 User1 Profile1 Yes 2 User1 Profile2 No 3 User1 Profile3 No Currently, User1 default profile is Profile1. That’s how it was setup initially when profiles were created. If User1 decided at a later stage to change his/…
MySQL CONCAT and INNER JOIN – Adding another child table
The query below creates a hierarchical relationship with tables and records: program -> accreditation_standard_group -> accreditation_standard -> learning_event Base on the following tables …
query has no destination for result data, select functions names from schema
I am trying to turn select into function, but keep getting error: “query has no destination for result data”. Select returns 5 columns so I am trying to return table with 5 columns. I can not figure out what I am missing, please help! Answer As the error message suggests, you have to tell the func…
MySQL – Query and group in a single row
I have a set of data as below: EmployeeId Salary_Basic Salary_Transport Year E001 12000 3000 2018 E002 9000 2000 2018 E001 13000 3200 2019 E002 10000 2400 2019 E003 15000 5000 2019 What I want is below: EmployeeID NetSalary_Year2018 NetSalary_Year2019 E001 15000 16200 E002 11000 12400 E003 0 20000 Can anyone …
SQL statement throws “dpiStmt_execute: ORA-01821: date format not recognized”
I am doing an SQL exercise, where I have to determine the amount of returned films to the film store at the given date “2005.06.05” and the number of films, which were borrowed at this date. Somehow I always get the errow message standing in the title. Does someone know how, where I made the mista…
SQL query – not null
I have sql query: I got this table id position10 position20 position30 1 2021-05-02 2021-05-02 2021-05-3 2 2021-05-15 2021-05-16 2021-05-18 3 2021-07-08 NULL NULL And I want lines where NULL values are not picked up. A try this: But it still chooses to me where the NULL value appears somewhere. Answer You nee…