Full error message Msg 245, Level 16, State 1, Line 2 Conversion failed when converting the nvarchar value ‘$28,926.25’ to data type int. Answer Something to understand when programming on almost ANY platform is converting between number values like 123.45 and string or text values like “123…
Tag: sql
Postgres comparing strings from json and table
I have the following postgres stored function: CREATE OR REPLACE FUNCTION wg.get_user( req jsonb) RETURNS jsonb LANGUAGE ‘plpgsql’ COST 100 VOLATILE AS $BODY$ DECLARE …
SQLite: How to see people that aren’t my friend, but are friends with my friends
I have a database in DB Browser where I have two tables; So my question is, how do I make a query that Displays People that I’m not friends with, but my friends are friends with them. It’s so I can find new friends basically. Answer You can join multiple times:
How do I join two tables from a database in SQL?
I’m currently working on a project where we have to join two tables in SQL and then create a page to show the result of the two tables combined. This is what I have so far: SELECT * FROM ANIMAL …
Upsert query is not updating the the records in postgres
I am trying to Upsert into the target table from temp table but My upsert query is not updating the records in postgresql. Although it is inserting but not updating. Please find below query: Insert …
Syntax Error pivoting a SQL table using string columns
I have a table Occupation like such: Name | Occupation —————– Sam | Doctor Joe | Professor John | Actor Hailey | Singer April | Doctor My goal is to utilize the PIVOT function to display …
UNPIVOT Holiday Hours
I have a table, that keeps track of store holiday hours: This is a highly oversimplified table. There’s about 30 columns horzontially consisting of store operating hours by date – It continues (DATE3, TIMES3, DATE4, TIMES4, etc). I need to unpivot the values vertically, ensuring the date and time …
Determining cause of query timing out
I have a query that I’ve spent some time optimizing, it will normally run in less than a second. Occasionally, though, it will take a minute or two to run which causes the calling application to throw …
Find missing entries by date
I have two redshift tables: alert_type: where i keep types of alerts in my system alert: where i keep alerts Every day I generate a new alert for each alert type. If something has failed in …
How to hide rows where aggregate functions are used
let’s imagine here is my report: select 1 from dual union all select 2 from dual union all select 3 from dual union all select 4 from dual Output: 1 2 3 4 If e.g. i want to hide part of the report …