Skip to content

Tag: sql

SQL Server : select first occurrence from two columns

(Edit: I am bound to use Visual Studio 19 and have no rights to install any other application) I have a small SQL table with about 150k rows and 20 columns which I need to modify. I need the table to be ordered by date. I need the first occurrence of a value from two columns. Depending on if the

Filter msdb.dbo.sysjobsteps.command into seperate columns

I am trying to split the msdb.dbo.sysjobsteps.command column into separate columns to show the following information: folder project dtx package A small sample of my data is below: I have tried to use the substring method, however I cannot seem to get the starting and ending number of the substring. My aim is…

SQL perform AVG after MAX

I have two tables. Table1: | ID1 | ID2 | ID3 | ID4 | |—–+—–+—–+—–| | 200 | 125 | 300 | 201 | | 206 | 128 | 650 | 261 | | 230 | 543 | 989 | 403 | and Table2: | ID1 | ID2 | ID3 | ID4 | …