Is there anyway in a select statment to list 5 fields but only display 3 of them? I need some of the fields for the order by clause but don't actually want them displayed. Is there a solution?
Here's the statement. There is a nested SQL statement in the order by:
SELECT (strLName + ', ' + strFName) as name
FROM UserInfo, LoginInfo
WHERE UserInfo.strUserID = LoginInfo.strUserID
AND strRights = 'user'
AND (strUserStatus = 'active'
OR strUserStatus = 'inactive')
ORDER BY (SELECT strLName + ', ' + strFName
FROM UserInfo
WHERE strAdminID = UserInfo.strUserID) ASC,
strLName, strFName, strUserStatus
What essentially we want to happen is just change the order by clause around depending on how the user clicks to sort the data. Does this make sense??
I'm struggling to make sense of this to be honest. Can you describe the tables you are using, the relationships between them and what results you want to see?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.