0
I have two tables Tb_process and Tb_costs united by key Numeroprocesso. I need lists of their union information sorted by Urgency and Date status. When urgent, they should be listed at the top of the list.
I’m not able to sort by date, from smaller to larger ex: 11/04/2019, 14/04/2019, 16/04/2019
SQL:
@AdvogadoID int,
@TipoCustas nvarchar(9),
@Numero int
SELECT TOP (@Numero)
Processo.NumeroProcesso,
Processo.GCPJ,
Processo.ProcessoID,
Processo.Natureza,
Processo.Valor,
Processo.Comarca,
Processo.Vara,
Custas.CustasID,
Custas.Descricao,
Custas.AdvogadoID,
Custas.ValorCustas,
Custas.DataCustas,
Custas.Concluida,
Custas.DataPrazo,
Custas.TipoCustas,
Custas.Urgencia
FROM Processo INNER JOIN Custas
ON Processo.NumeroProcesso = Custas.NumeroProcesso
WHERE (Custas.AdvogadoID = @AdvogadoID)
AND (Custas.TipoCustas = @TipoCustas)
ORDER BY Custas.Urgencia DESC
ORDER BY Costs.Urgency DESC, Costs.Timeframe was simply that!
– Evandro
Good, I hope I helped.
– jeovani thomazini