I am creating a wizard and have a tabs table to dynamically build navigation. I need to return a recordset with an Active/Inactive Value for each record (tab) to render the tab in the appropriate format.
I have 2 queries, one to return the records, and a second to determine Active/Inactive that work seperately, but how do I join the Active/InActive evaluation to the larger query returning the recordset? If I make a seperate SP call for each record that seems inefficient.
Here is my best shot
(plagued by Syntax Errors:
Incorrect syntax near the keyword 'IF'.
Line 19: Incorrect syntax near 'Active'):
SELECT *,
(
IF (SELECT Tabs.TabOrder FROM Tabs WHERE TabID=@CheckTab)<=(SELECT Tabs.TabOrder FROM Tabs WHERE TabID=@CurrTab)
BEGIN
'Active'
END
ELSE
'InActive'
)AS tStatus
FROM Tabs
WHERE ParentTabID = 1001
ORDER BY Tabs.TabOrder
Please let me know any thoughts.....
I have 2 queries, one to return the records, and a second to determine Active/Inactive that work seperately, but how do I join the Active/InActive evaluation to the larger query returning the recordset? If I make a seperate SP call for each record that seems inefficient.
Here is my best shot
(plagued by Syntax Errors:
Incorrect syntax near the keyword 'IF'.
Line 19: Incorrect syntax near 'Active'):
SELECT *,
(
IF (SELECT Tabs.TabOrder FROM Tabs WHERE TabID=@CheckTab)<=(SELECT Tabs.TabOrder FROM Tabs WHERE TabID=@CurrTab)
BEGIN
'Active'
END
ELSE
'InActive'
)AS tStatus
FROM Tabs
WHERE ParentTabID = 1001
ORDER BY Tabs.TabOrder
Please let me know any thoughts.....