Skip to content

Tag: sql

Split multiple strings in SQL

I am trying to split multiple columns of strings at the same time. My original data looks like: Table1 UserID Type ProductID 1 A, B 001, 003 and I want to end up with UserID Type ProductID 1 A 001 1 B 003 When I use I end up with this table that I do not want… UserID Type ProductID

SQL where clause selecting specific data

In Microsoft SQL, I am trying to select a specific result from a table when available. Otherwise, other data should be retrieved. Giving the scenario tableA contains various fruits. I want to collect apples that are red otherwise, any other colors except for red should be retrieved. I am not sure which approa…

SQL: How to return revenue for specific year

I would like to show the revenue for a specific year for all customers regardless of whether or not they have revenue data for the specific year. (in cases they dont have data for the specific year, a filler like ‘no data’ would work) Sample Data looks like: Table 1 Customer Price Quantity Order D…