New to SQL but I’m trying to find titles wherein the words “blue” and “black” are present. However, they cannot be from users who have ids of 1 and 5. This is what I did: However, when I add that id 1 and id 5 shouldn’t be in the query, it shows me something like this: Blog Title User The
Tag: sql-server
How to add ” and , for multiple ID in SQL Server
I am writing a SELECT query that has multiple id, and I have to manually add ”,” (e.g ’12L’,’22C’). I have around 2000 id in an Excel sheet. Is there any quicker way to add ”,” to all the ID? Answer Here is a conceptual example for you. It will work in SQL Server 2012 onwards. It is a three
Select data based on certain set frequency
I have the following table settings What I need is to select the entry based on whether it is allowed to trigger on date that or not. So lets say for example for the following entry id:xxx, trigger_metric: MONTHS, trigger_frequency:1 , trigger_start_date:’2021-09-01′ the row should be selected on the trigger_start_date and then every trigger_frequency trigger_metric i.e. 1 MONTHS in this
Two intervals coincide at some point in SQL-Server
How to know if two intervals coincide at some point? I have two tables that store two intervals where the values mean meters. The first interval corresponds to geological codes (VBv, P4, etc). The second interval corresponds to samples. They are connected through a field called Hole ID. I need all the sample ranges that match the code ranges, putting
select smalldatetime between two strings
What am I doing wrong ? Desired Output: Column InRange should contain YES for two last rows. Answer Try specifying ISO format dates, more than likely your regional settings are having an effect. If you use YYYYMMDD there is no ambiguity. The following works fine:
How to parse comma delimited list and join those values on another table and reconcatenate? [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 last year. The community reviewed whether to reopen this question last year and left it closed: Original close reason(s) were not resolved Improve this question I’m looking for a way to
SQL query to find columns having at least one non null value
I am developing a data validation framework where I have this requirement of checking that the table fields should have at least one non-null value i.e they shouldn’t be completely empty having all values as null. For a particular column, I can easily check using If it’s greater than 0 I can tell that the column is not empty. I
SQL -Listing between Two dates for each record
My data source looks like below. And I want output like below. Basically, it should list each Employee multiple times for each date between those periods. For quick and easy, below is the Temp Data code. Answer Build a calendar table and join that.
Get values “0” and “1” alternated rows on SQL
I’m using SQL Server 2015, I have a table with a list of values “name”, my necessity is to add a column that alternate values “0” and “1” when the “name” columns changes. This is important for me because, I import this query on excel, and I will format the rows with conditional formatting reading the value of “trig”. This
Filtering/ORDER BY – Practice
I ran into a small issue with a order I am trying to do and not sure if there is a solution to what I am trying to accomplish. I have the following table created… CustomerID is PK and I can’t change the numbers around. The goal is to get the table to look like this: The first part of