Tag : sql-server

I am working on converting values to overpunch by joining an overpunch table to a purchases table, but for a report that sums up the purchases I am having trouble avoiding putting overpunch in the group by. Below is my current code and the overpunch table I am using. I think this could be solved with a CTE but I have not had luck with i..

Read more

I am trying to pull addresses based on their type from certain accounts. The relation between the two tables is not based off account type but rather a customerId (a customer can have many different accounts whose accounts have their own separate ID’s). The customers account have a profile number and parent profile number either of which is linked to the profile number in the address table. So, what I am trying to do is determine if the account profile number is in the address table (as fintProfileNumber) and if it is list the address if it is a mailing address, if not then check if the account parent profile number is equal to the profile number in address table (as fintProfileNumber) and list that address if it is a mailing address. If none of these are present then use the default mailing address in the account table. I have attached an example of the t..

Read more