Skip to content
Advertisement

Tag: database

SQL result dense Rank in revolving group pattern

Say I have a table like store date is_open Bay 1/1/2022 true Bay 1/2/2022 true Bay 1/3/2022 true Bay 1/4/2022 false Bay 1/5/2022 false Bay 1/6/2022 false Bay 1/7/2022 true Bay 1/8/2022 true Bay 1/9/2022 true Walmart 1/7/2022 true Walmart 1/8/2022 false Walmart 1/9/2022 true I want them to use partition by and get the rank of the group such

Obtain Name Column Based on Value

I have a table that calculates the number of associated records that fit a criteria for each parent record. See example below: note – morning, afternoon and evening are only weekdays What I am trying to achieve is to determine which columns have the lowest value and get their column name as such: Here is my current SQL code to

How to make correct query with complicated conditions?

I have this table: I need to select only that band_names which participant set is not changed all time of its existance(date_join == active_years_begin and (date_left is null or active_years_end is null) or (date_left == active_years_end)) ) for all band participants. So here right answer is The Beatles, Wings, Band1, Band2, Band3, Band4. How can I do that? Answer

Advertisement