Skip to content
Advertisement

Tag: tsql

Select to pull Zip code based both foreign and domestic

I need to write a T-SQL procedure where the parameter is zip code. We’ve got the following parameter declared. Sample data in table: postal_codes NULL 46383 074523632 B4H34 113601419 ZH/8600 A1G 9Z9 WN73R Wd3 3he 89136 etc. We’ve got a variety of addresses some having no postal code for certain foreign countries to some having your standard 5 digit or

How to find the sum from value of sql column

I have two tables with following data. studenttbl: feetbl: I need to find below data, but I am not getting balance value of seatno 1006: I am using this SQL query: Please help me with this. Answer This issue is due to INNER JOIN versus LEFT JOIN. When you INNER JOIN youll only get matches between two tables. When you

Reset ROW_NUMBER() when previous partition ID changes

I am trying to reset the ROW_NUMBER() value when there is a change in one of the IDs when sequenced in datetime order. For example in the table below, when Location_ID changes, I want to reset the RowNum to 1. Here’s the statement I am using. I get RowNumX, but want RowNumY. EventDate Scan_Timestamp Asset_ID Location_ID RowNumX RowNumY 9/1/2021 09/01/21

Advertisement