Skip to content

Tag: sql-server-2012

Insert differences between 2 tables into 3rd table

I have total of 3 tables in my database. My Testing1 and Testing2 table have two exact columns (ItemID and ItemPath). My Testing3 have three columns (ItemID, ItemPath and Source). I’m trying to compare Testing1 with Testing2 and insert the difference to Testing3. I’m able get the the difference but I’m just wondering how can modify it to meet this

SQL Group Multiple Results from Single Table

I have a table that contains a line entry for each item that I need to group into an output with all the values of multiple rows that have the same uniqueID into one column result. The ItemType will be different but the UniqueID and OtherData shouldn’t change as it’s tied directly to the UniqueID, but I’m not 100% sure

Trigger causing Maximum trigger nesting level exceeded

I have created a new trigger that updates my [Purchase Table] if the number of delivered items equals the ordered quantity, but every time it’s run I get the following error. ODBC–update on a linked table ‘dbo_Purchase Table’ failed. Maximum stored procedure, function, trigger or view nesting level exceeded (limit 32). (#217) This is the trigger that I have created:

Include Medians for grouped query .

I have this query that I need to graph. The graph will show Total patients, patient Longest wait (minutes) and patient Median wait for each location. I need to include Medians in my query, and that is where I am stuck. Example Raw Data: Query I have so far w/o Medians: Output: I need help getting a last column of