Skip to content

Tag: sql-server

Return Data based on Column

I am modifying a current query which returns n amount of rows. I would need to return the same amount of rows but with one more column of data. I have two sql tables shown below. Products and Product Attribute Values. When i run this query i get a few 1000 rows back. But when i run this query I

Get Row based off Date and previous row

I’ve got the following sample data and what I’m trying to do is based off the DateChanged value is get the appropriate Amount from the linked table along with the previous row. The results would then display as How could this be done? What I have so far is this but wondering is there’s a bet…

Column to see Completion

I’m trying to come up with a way to add an extra column to this result-set that is a bit value of 1/0if the particular owner has all the rows as not null. The column would be: Answer You can use window functions: