I have a SELECT query
SELECT a.STAFFNO,a.REGION,a.DEPARTMENT,
LEFT(REGION,3)AS REGCODE,
LEFT (DEPARTMENT,4)AS DEPTCODE
(DEPTCODE + REGCODE) AS ACCODE
(DEPTCODE + REGCODE) AS COSTCNTRE
FROM ELYOSERVICES.dbo MASTER a
WHERE STATUS ='Active'
Users enter REGION and DEPARTMENT from a pick list for each Employee in the database. The formate is
REGION: adc - Midlands - Birmingham
DEPARTMENT: 1234 - Engineer
I need to capture just the first part of each, join them and update ACCODE and COSTCNTRE (1234adc)in the same database.
I am not sure how to change the query to update these fields, can anyone help?
SELECT a.STAFFNO,a.REGION,a.DEPARTMENT,
LEFT(REGION,3)AS REGCODE,
LEFT (DEPARTMENT,4)AS DEPTCODE
(DEPTCODE + REGCODE) AS ACCODE
(DEPTCODE + REGCODE) AS COSTCNTRE
FROM ELYOSERVICES.dbo MASTER a
WHERE STATUS ='Active'
Users enter REGION and DEPARTMENT from a pick list for each Employee in the database. The formate is
REGION: adc - Midlands - Birmingham
DEPARTMENT: 1234 - Engineer
I need to capture just the first part of each, join them and update ACCODE and COSTCNTRE (1234adc)in the same database.
I am not sure how to change the query to update these fields, can anyone help?