Como obter resultado por condicional de função lógica em Consulta (SELECT) existente na linguagem de Manipulação de Dados (DML) do Azure SQL/SQL Server
This T-SQL code performs a query on the "erp. Collaborators". I'll explain each
ID], IIF([Dismissal] IS NULL, 'I', 'A') as Status
FROM [erp].[ Collaborators]
ORDER BY [ID] DESC
code returns employee IDs and a status ('I' for Inactive, 'A' for Active) based on the presence or absence of a resignation date in the "Resignation" column. The results are sorted by the IDs in a descending fashion. This query is useful when you want to view the status (active or inactive) of collaborators in descending order of ID.
Data Scientist and Consultant for Digital and Analytics Solutions
@fabioms