Assuming I have a dataset like this: What I need to do is to make a dataset like this in SQL Server. Any help is appreciated: Code on pastebin: https://pastebin.com/SjGbD6Cc CREATE TABLE “…
SQL Table Comparison Taking Extended Periods of Time
I am working on building an application to assist with taking data from different sources dynamically Files and Emails (usually CSV and Excel), APIs, and other SQL Databases and processing them and …
Select distinct rows where all values are in group
I have a table that stores a one to many relationsion (caseid to code). It is possible for one caseid to have many codes. I would like to select all rows where all the codes for a given caseid are …
SQL Conditional on SELECT Subquery value
I want to apply a condition check on my select subquery. How can I do it optimally? Here’s the initial query: SELECT table1.column1, (SELECT min(table2.column1) FROM table2 WHERE table2.table1Id …
Microsoft SQL Server database / Visual Studio C# : date handling
I’m trying to figure out what would be the quickest and most convenient way to grab dates from the database and parse/cast them correctly into my DAL (DataAccessLayer) methods. The columns inside my …
how to select max score from duplicate mobile_number
how can I filter record 60122839991 with the highest score 95.3758 and return as below without duplicate phone number Answer Use distinct on:
How to compare rows as lists in SQL?
I have a many to many table which has 3 primary keys shown below : table1 : key_1, key_2, key_3 I want to compare rows as lists, For Example : table1 would be : key_1 key_2 key_3 row1: 10 |…
Eliminate double quotes from a json field in a selective manner in PostgreSQL
I’m a new user of a PostgreSQL database with a json field which causes me some trouble. In fact, string values have been inserted into this json filed with double quote when they are supposed to be numerical values. I have a field named “test_json” which is composed of for example these 2 ro…
DB2 z/OS – Get the last 2 digits of year
SELECT SUBSTR(CAST(YEAR(SOMEDATE) AS VARCHAR(4)),2,2) AS “YY” FROM SOMESCHEMA.FOO; Gets me the following error: [Code: -104, SQL State: 42601] ILLEGAL SYMBOL “,2”. SOME …
How to substract 2 columns from different table with using count function? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Currently, I am using count function to calculate the value for 2 columns and wanna substract…