troubleshooting Question


Avatar of RDB1369
RDB1369Flag for United States of America asked on
Microsoft SQL Server
2 Comments1 Solution553 ViewsLast Modified:
I am buiding a view in SQL with information coming from two files.
File A has
Invoice Number
Flag if it has a Summary Invoice Number
File B has
Invoice Number
Summary Invoice Number

I want my view to have
Invoice Number, Summary Number, Counter

I want the counter to increase each time the same summary number is used.  If there is no summary invoice number the counter would be 1.

Row 1
Invoice Number = 1
Summary Number = 100
Counter = 1
Row 2
Invoice Number = 2
Summary Number = 100
Counter = 2
Row 3
Invoice Number = 3
Summary Number = 200
Counter = 1
Row 4
Invoice Number = 4
Summary Number = NULL
Counter = 1

Can anyone help with the code for the counter

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros