Re: Select statement and conditional value
From: Roji. P. Thomas (lazydragon_at_nowhere.com)
Date: 09/28/04
- Next message: Jacco Schalkwijk: "Re: Select statement and conditional value"
- Previous message: Raterus: "Re: Snapshot Relational Data into New Tables"
- In reply to: Jim Abel: "Select statement and conditional value"
- Next in thread: Jacco Schalkwijk: "Re: Select statement and conditional value"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Sep 2004 21:58:58 +0530
SELECT ac.ServerID, ac.PolicyID, ac.Status, ac.CurrentValue,
CASE WHEN pd.Automated = 1 Then '*' + pi.PolicyText ELSE pi.PolicyText END
AS PIText,
pi.PolicyIPM, pd.Automated AS audComplianceStatus
FROM auxtatus ac INNER JOIN
auxInfo pi ON pi.PolicyID =
ac.PolicyID INNER JOIN
auxDetail pd ON pi.PolicyID =
pd.PolicyID
WHERE (ac.ServerID = 351) AND (ac.Status = 0) AND
(pd.OS = 'WINDOWS')
ORDER BY ac.PolicyID
-- Roji. P. Thomas Net Asset Management https://www.netassetmanagement.com "Jim Abel" <jim.abel@lmco.com> wrote in message news:2dd301c4a577$2ac177f0$a501280a@phx.gbl... > I'm thought that I saw or read something that showed how > I could return a text column or a concanted column > depending on the value of another field in a select > statement. See the following statement. > > SELECT ac.ServerID, ac.PolicyID, ac.Status, > ac.CurrentValue, pi.PolicyText AS PIText, pi.PolicyIPM, > pd.Automated AS audComplianceStatus > FROM auxtatus ac INNER JOIN > auxInfo pi ON pi.PolicyID = > ac.PolicyID INNER JOIN > auxDetail pd ON pi.PolicyID = > pd.PolicyID > WHERE (ac.ServerID = 351) AND (ac.Status = 0) AND > (pd.OS = 'WINDOWS') > ORDER BY ac.PolicyID > > > > What I really want is if the Automated field is true > (it's a bit field with either 1or 0) I would like to > append an astrisk "*" to the beginning of the PolicyText > value other wise just return the PolicyTest value > > Is this possible? if so what does the syntax look like? > > Thanks
- Next message: Jacco Schalkwijk: "Re: Select statement and conditional value"
- Previous message: Raterus: "Re: Snapshot Relational Data into New Tables"
- In reply to: Jim Abel: "Select statement and conditional value"
- Next in thread: Jacco Schalkwijk: "Re: Select statement and conditional value"
- Messages sorted by: [ date ] [ thread ]