how to show empty value for a int datatype in SQL? I have a case statement on an int datatype column to show empty for the values less than or equal to 0. case when [TotalValue]
Tag: sql
Adding sheet name as column to query in Google Sheets
I have a Google Sheets document with my video game collection. Each console system has its own sheet, but I decided to consolidate all sheets into one new sheet as an overview using a query that looks something like this: This works fine, and I’m satisfied with it. However, my collection is quite large …
SQL LIKE operator with aaa% having strange behavior
In my case I have patient table with few columns including patient’s firstname and lastname. Application using this table having patient search functionality with firstname and lastname. Having some …
Count child members from parent value
I have a table like conversations and conversation_timelines conversations table example | id | last_active | category_id | |——————————————-| | 1 | …
How to Filter multiple values for Where statement of SQL
Can any help on the below Query in the where statement in T-SQL? I have ID & Product fields in table,in where condition need to exclude the ID not in(’11’,’22’,’33’) only when for Product=’c’ …
Getting Distinct Id(FK) by the latest date in SQL Server
I’m currently working on a query where I need to distinct ID based on the latest date created. Here is my diagram | ID | ModelID | LocationId | DateCreated | |——+—————-…
Extract a specific value from a string in a column
Need help with a situation, I need to extract a specific value from a column containing string. The string varies over different records, but the value I need to extract is always preceded by the word “VERSION” I tried to user REVERSE & SUBSTRING but not able to get exact results. Any help wil…
Adding missing records from another columns in a different table
I have 2 tables : Table A: A | B | C | D qwe 4 2019 10 qwe 2 2020 5 qwe 5 2019 5 Table B : A | B 3 2019 4 2019 5 2019 6 2019 7 2019 8 2019 9 2019 10 2019 11 …
How to do sub-string calculations in SQL?
I am working with a table full of customer online orders. Each order has a company code which can be either ’09’, ’07’, ’04’, ’03’, and ’01’. Each order has an order number that looks something like …
Duplication of results after selecting data from two tables with the same values
Good day! I’m having a problem in duplication of results when I’m selecting data from two tables with the same values. I have one data in my first table homepost with an ID of 2 and I have three data …