Dear Forum Members,
I am working on a SQL query for couple of days for which I am not able to arrive at a solution:
Below is the table structure:
Customer# Account # State CreditLimit
abc 1 NY 10,000
abc 2 CA 10,000
abc 3 NY 10,000
abc 4 GA 10,000
The requirement is that we need to find the State NY (only one record) and take the credit limit and rest of the record's credit limits should be flagged as 0 (zero). If the customer is not located in NY, we need to pick up the first account record's credit limit and mark the remaining records as zero.
I'm using CASE logic to find the first record, but I am not sure how to flag the other records with zero values.
I am working on a SQL query for couple of days for which I am not able to arrive at a solution:
Below is the table structure:
Customer# Account # State CreditLimit
abc 1 NY 10,000
abc 2 CA 10,000
abc 3 NY 10,000
abc 4 GA 10,000
The requirement is that we need to find the State NY (only one record) and take the credit limit and rest of the record's credit limits should be flagged as 0 (zero). If the customer is not located in NY, we need to pick up the first account record's credit limit and mark the remaining records as zero.
I'm using CASE logic to find the first record, but I am not sure how to flag the other records with zero values.