Colouring in the SQL query field

Hello,

I want to make a dynamic colouring process in order to highlight the DELAYED_TARIH field in my query. If the date is today's date, I want it to remain red if it is a date that is not yet due, I want it to remain green.

I am waiting for your help in this regard, thank you.

SELECT
Caption AS LOKASYONADI,DetailsUrl AS [_LinkFor_LOKASYONADI],
Nodes.CustomProperties.LokasyonNo AS TEMOSNO,
Nodes.CustomProperties.TRANSPOL_HIZ AS TRANSPOL_HIZ,
Nodes.CustomProperties.GECICI_HIZ AS GECICI_HIZ,
Nodes.CustomProperties.GECICI_TARIH AS GECICI_TARIH
FROM Orion.Nodes
where Nodes.CustomProperties.GECICI_HIZ >= 1
and (Nodes.CustomProperties.Department IN
('IL E', 'HT KAPISI', 'YEDEK HAT', 'MERKEZE BAGLI LOKASYON', 'BSSS', 'ANA HAT' , 'KHK', 'DHK', 'HKK' , 'HAVALIMANI'))
order by GECICI_TARIH ASC;

Parents
  • Cevaplarınız için teşekkür ederim
      dedi, case sorgusunu kullanarak düzenleme yaptığımda 'Sorgu geçerli değil' hatası alıyorum.

    Sorgu düzenlenmiş hali doğru mu? Sorun nerede?

    SELECT
    Caption AS LOKASYONADI,
    DetailsUrl AS [_LinkFor_LOKASYONADI],
    Nodes.CustomProperties.LokasyonNo AS TEMOSNO,
    Nodes.CustomProperties.TRANSPOL_HIZ AS TRANSPOL_HIZ,
    Nodes.CustomProperties.GECICI_HIZ AS GECICI_HIZ,
    CASE
    WHEN Nodes.CustomProperties.GECICI_TARIH >= GETUTCDATE() THEN
    CONCAT('<span style="color: #6A5ACD;">', CAST(Nodes.CustomProperties.GECICI_TARIH), '</span>')
    ELSE
    CAST(Nodes.CustomProperties.GECICI_TARIH)
    END AS GECICI_TARIH
    FROM Orion.Nodes
    WHERE Nodes.CustomProperties.GECICI_HIZ >= 1
    AND Nodes.CustomProperties.Department IN
    ('IL E', 'HT KAPISI', 'YEDEK HAT', 'MERKEZE BAGLI LOKASYON', 'BSSS', 'ANA HAT' , 'KHK', 'DHK', 'HKK' , 'HAVALIMANI'))
    ORDER BY GECICI_TARIH ASC;

  • I don't believe you can use CAST but otherwise that looks OK at a glance

Reply Children
No Data