I’m hoping to find duplicates across groups of IDs. The Dup variable defines whether an Item has reappeared in other ID groups.In other words, if the same item is found in another ID then Dup is ‘yes’….
How to compare values with the same ID but different other attribute?
+——+——+——+ | ID |letter|number| +——+——+——+ |1 |A | 23 | +——+——+——+ |1 |B | 45 | +——+——+——+ |2 |A | 37 | +——+——+–…
How to use CHECKSUM in a trigger
I’m trying to create my own logic for tables synchronization in SQL Server Express 2019. I was hoping that such simple task would work: Have a Customers table Have a Synchronization table CREATE …
Calculating returns within SQL query
I have data on stock prices for multiple companies for the last 10 years. I want to be able to query this table to return the annual (calendar year) stock price return for each of these stocks. Note …
Returning Null Value – Coalesce and ISNULL
I may be having a brain fog, but if I have below: Which gives me the value of invalid for all fields in my info column that have an empty space, if I used ISNULL instead of COALESCE would it give me the same result? I cannot access a sql engine currently so just wanted to sanity check. Thanks! Answer
Migrate columns to JSON in SQL
I have a table (Table A) that looks like this: I want to convert it to a table (Table B) like this How do you insert/transform into a json column? Or do I just have to construct the json string myself? Additionally, does the nullableness of the int columns affect creation? Are clicks for example not included …
Split value into multiple rows
The following are two tables I have in the database mavenmovies. testLocation (TABLE 1) CREATE TABLE mavenmovies.testLocation ( id INT AUTO_INCREMENT PRIMARY KEY, State varchar(255), name …
count distinct if a condition is satisfied
I have a table which shows if a address_no has a telephone or not. To determine, i am looking at cell_phone and house_phone columns and want to write ‘no phone’ only when house_phone and cell_phone is …
Select from dynamic table
I need to run a query in sql that depending on the month and year I need to call a different table. For example: If current_date is 31/08/2020, execute: select * from table_ago If current_date is 01/09/2020, execute: select * from table_sep Is it posible using a query in SQL Server? Answer You can use a store…
Auto increment temporary column in select statement MySQL 8
Hello i use this type of sentence to return an auto increment column in my prepared statement selects cnt := cnt + 1 SET @query = CONCAT(‘SELECT * FROM (SELECT (@cnt := @cnt + 1) AS id, a….