Skip to content
Advertisement

Tag: tsql

Comparing two tables without foreign key [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. Improve this question There are two tables in 2 different databases one table consists of Salutations example Mr, Miss and other table has names with Salutation example Mr.XYZ, Miss.ABC

TSQL to perform aggregation with Exists

My sample data source is following I want SQL to check if there exists any row with cond=X or cond=Y by site and if yes, don’t perform any aggregation; if no, perform a sum of val. I am currently achieving it by following Method1 Method 2 I was wondering if there is any better way of achieving this. Edit Desired

Adding x work days onto a date in SQL Server?

I’m a bit confused if there is a simple way to do this. I have a field called receipt_date in my data table and I wish to add 10 working days to this (with bank holidays). I’m not sure if there is any sort of query I could use to join onto this table from my original to calculate 10

Trying to exclude certain users

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

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

Advertisement