I need to see purchases that do not have a nombre_etapa
associated with it.
I leave the code:
SELECT
re.[compras] AS compras,
(
SELECT e.[nombre] as nombre_etapa_e
FROM [Control_Documental].[dbo].[Registro_Etapa_Documento] AS e
) as nombre_etapa
FROM [Control_Documental].[dbo].[Requisicion] AS re
LEFT JOIN [Control_Documental].[dbo].[Registro_Etapa_Documento] AS e ON e.[idEtapa] = re.[idEtapa]
WHERE
e.[nombre] IS NULL
It looks very simple, but I do not know how to bring it.
I currently call it as I wrote it above, but it does not bring me any data, being that there are purchases that do not have associated e.[nombre]
.
This query is much more complex, I just summarized it, the subselect if necessary.
The subject is how to call when it is an subselect that brings a data, from the WHERE
main of the query.
If I wanted to call the empty associations of re.[compras]
I just call them with WHERE re.[compras] IS NULL
. but when there is a subselect
that brings the data, I can not see how to bring the null data.