I'm trying to do something like this in Microsoft SQL Server:
DECLARE @isparent int;
SET @isparent = iif(account.parentid is not null,
1,
0);
SELECT
IIF(@isparent = 1,
parentenrollment,
enrollment) "Enrollment"
FROM
Accounts
Obviously this is greatly simplified, but the idea is to store in a variable (@isparent, above) a value based on something from a table and then later re-read that variable, using it to determine what values to show.
Is this possible? If so, how?
account.parentidis a typo and you meanaccounts.parentid