troubleshooting Question

Create new field based on results of existing field

Avatar of Grayson Hampton
Grayson Hampton asked on
* T-SQLSQL
7 Comments2 Solutions55 ViewsLast Modified:
I need to create a query that assigns a 1 to the first occurrence of a value and a 0 to any occurrence after for the BatchID field.'
The result would look like "NewField"

CompanyID       JobType            TempID                    Customer ID        OfficeID              SBUID      JobNumber      ConsultantID              BatchID              NewField
ADSE             Temp Job      2449129            113517               DENVER               ADMN       131705            2375138            TSB1.6.18A       1      
ADSE             Temp Job      2449129            113517               DENVER               ADMN       131705            2375138            TSB1.6.18A       0    
ADSE             Temp Job      2642569            113517               DENVER               ADMN       132512            2375138            TSB1.6.18B       1
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 7 Comments.
Join the Community
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 2 Answers and 7 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