Skip to content
Advertisement

Tag: join

Select info from row to another row

I have this select on a view: And get this: And I want that the last row be like this: That is, the values of all columns equal to the other rows, except column ‘C’ and column ‘D’. The value of column D is obtained from T2.D How can I do? Thanks. Answer Without any sample data to use I

How to do a join to get previous days values?

I want to join tables as follow: Report_Period Entity Tag Users Count Report_Period_M-1 Report_Period_D-1 … 2021-03-31 entity 1 X 471 2017-05-31 2021-03-18 … 2020-12-31 entity 2 A 135 2020-11-30 2021-03-18 … 2020-11-30 entity 3 X 402 2020-10-31 2021-03-18 … With a view containing Day – 1 results as follow : Report_Period Entity Tag Users Count Report_Period_D-1 2021-03-31 entity 1 X

SQL Server filling gaps in time series

I’m having trouble with a request in SQL. I have two tables, one representing a vector of dates and another timeseries of prices for different securities: Dates: DateId Date 1 2021-01-01 2 2021-01-02 3 2021-01-03 TimeSerie: SecurityId DateId Value 1 1 0.25 1 3 0.32 2 1 0.41 2 2 0.67 The timeserie may have gaps, for example in the

How to join two tables and add a limit

Given two tables in a SQLite database, app_vendor app and I am trying to get 10 ‘names’ from ‘app’ (names of apps) for a given ‘vendor_id’ What am I doing wrong? Answer Your WHERE clause is in the wrong location. You can do: Result: See running example at DB Fiddle.

All categories for each week and group

Hi I have a data source as such Data: Weeknum Group Priority Total 202106 A High 10 202106 B Medium 15 202107 A Medium 88 Priorities: Priority High Medium Low The data has already been grouped such that each weeknum+group+priority is unique. What I need to do is return the full list of priorities for each week/group including zeros: Weeknum

Advertisement