Select only rows that have a value for all categories in a column after group by

DB fiddle: https://dbfiddle.uk/QLKIuW1G For a given table, I have grouped by two columns and calculated the average of a third column. However, I would like to only get rows that have a value for all possible values in the category column (these are 1 and 2). How can this result be achieved? Example table: |… Read More Select only rows that have a value for all categories in a column after group by

How to transform table with several columns into a keyword table

I have a table with columns like CustID, FirstName, LastName, PhoneNumber, Membershiplevel, etc. I want to produce a table with these columns: CustID, Keyword, Value. The column names would be the keywords, and there would be a row for every keyword. So this: CustID, FirstName, LastName, PhoneNumber, MembershipLevel 1234 Joe Smith 555-555-5555, Select Would become… Read More How to transform table with several columns into a keyword table

T SQL Extract String between penultimate and last comma

I’m using MS SQL Server 2014 SP3. I have a column called person_loader that contains one large string. I have no control over this as its from a 3rd party system. Sample data: 1. Bob Smith, 01/01/1980, "email: bob@test.com, mobile: 012345687",USA, Joiner, 05/04/2022 2. Dolly Smith, 02/03/1978, "email: dolly@test.com", UK, Singer, 3. Dave Smith, 09/08/78,"mobile:… Read More T SQL Extract String between penultimate and last comma