I am trying to assign a value to a variable based on the results of a view. For example, if the value of a column comes back as NULL then I want my variable to equal 0. If the column returns something other than NULL, then I want the variable to be assigned a 1. Is this even possible within SQL? I am not very familiar with SQL, but I would be able to do this in other languages, and considering the popularity of SQL, I have to believe this is possible. Any help would be greatly appreciated... Here is the code that I am currently working with...
SELECT a.*, b.user_name
FROM groups As a
LEFT OUTER JOIN
(SELECT User_Name, Group_Name
FROM user_access
WHERE User_Name = 'name') As b
ON a.name=b.group_name
And if the value of User_Name comes back as NULL then I need a variable to equal 0. If the value comes back other than NULL, then I need the variable set to 1. Thanks in advance...
Bene1
SELECT a.*, b.user_name
FROM groups As a
LEFT OUTER JOIN
(SELECT User_Name, Group_Name
FROM user_access
WHERE User_Name = 'name') As b
ON a.name=b.group_name
And if the value of User_Name comes back as NULL then I need a variable to equal 0. If the value comes back other than NULL, then I need the variable set to 1. Thanks in advance...
Bene1