Skip to content

USE and UNION ALL

I am working with MS SQL Server and I am trying to gather informations from a few different databases and I need the results in one table. USE [1st Database] select smthing USE [2nd Database] …

SQL: Trying to select records 7 days before date

I have a table with a date field called oppo_installdate. This is a date in the future, and I basically want to select records where this date is 7 or fewer days from the current date. I have tried to do this with the query below but it is older returning dates from 2019 as well, and I’m not sure

T-SQL Equivalent of regular expression ‘b’

I’m in the process of converting a CLR function that utilizes regex to a SQL function. I know that SQL Server does not fully support regex, but i just need one case to work which is a word search. Search Field Value: {“Id”:1234, “Title”: “The quick brown”} Regex Patte…

TypeORM – How to remove last added row?

I’m trying to remove only the last added row. Instead, of the last one, it removes all rows. I was thinking about adding where corresponding to the newest date but I feel it’s not a good approach to solve this problem. Answer Use a subquery to query the last insert row first, then delete this row …

How to use join to link values from one table to another

I have two tables. drivers name number email requests id driverassigned …. I want to get everything from drivers table that may or may not be mentioned in requests.driverassigned. I have tried using join but it returns rows that have a match. Here is what I have so far. I am sure there is a common solut…

Merge two tables in SQL, with one common column

I’m trying to merge to tables in MSSQL, as in the sample below. My situation is similiar to this question. T-SQL merging two tables with common and uncommon columns I have tried using the following query: But it results in this, where the rows that have the same value in column a, merges in the same row…