my query result will be given below.i want to get result like Marked one.
in 2025 no data for Query,ABC company .so i want to display it as Pening in next row

my query result will be given below.i want to get result like Marked one.
in 2025 no data for Query,ABC company .so i want to display it as Pening in next row

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tuhin PaulRank #7 · 71.9K reputationPosted Jan 17, 2025, 1:03 PM EST
SELECT Year, Name_E, OrgID, CASE WHEN Year = 2025 AND Name_E = 'ABC' THEN 'Pending' ELSE 'Data Available' END AS Status FROM Tablecheck with something like this query.
Compare your query result with a reference table that contains the expected entries for each year and name (e.g., the
Messagestable). If data is missing for a given year and organization (like ABC company in 2025), you can show "Pending" in that row.Tuhin PaulRank #7 · 71.9K reputationPosted Jan 17, 2025, 1:05 PM EST
You can join the
Tablewith theMessagestable to check that all rows from theTableare included, and for the missing rows (where no match is found in theMessagestable), display "Pending". This avoids hardcoding specific conditions. If you’re missing data in theMessagestable (for a specificOrgIDandYear), you can handle it withCOALESCEorIFNULLto substitute a "Pending" value for the missing data.SELECT t.Year, t.Name_E, t.OrgID, CASE WHEN m.OrgID IS NULL THEN 'Pending' ELSE 'Data Available' END AS Status FROM Table t LEFT JOIN Messages m ON t.OrgID = m.OrgID AND t.Name_E = m.Name_E