×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Cannot use DISCTINCT command when combining to columns in my query????

Cannot use DISCTINCT command when combining to columns in my query????

Cannot use DISCTINCT command when combining to columns in my query????

(OP)
Hello,

i am having a problem getting unique records when combining two columns in my query. Can the DISTINCT command be used with the CONCAT command or the || || operator. I am using MS Query and when i enter in my query with DISTINCT, it says "DISTINCT is not a SELECTed operator" and then it wont work. Can someone please help me out here. This is my query that i am using that works. This query returns a list of users by their last name then a comma then their first name, and then it sorts the names.

SELECT GE_USER.LNAME||', '||GE_USER.FNAME
FROM MSA.DE_ACCOUNT_EXEC DE_ACCOUNT_EXEC, MSA.DE_DEAL_HDR DE_DEAL_HDR, MSA.GE_USER GE_USER, MSA.GE_USER_JOB GE_USER_JOB
WHERE DE_DEAL_HDR.DEAL_ID = DE_ACCOUNT_EXEC.DEAL_ID AND GE_USER.GAB_ID = DE_ACCOUNT_EXEC.GAB_ID AND GE_USER.GAB_ID = GE_USER_JOB.GAB_ID AND ((GE_USER_JOB.JOB_ID=1))
ORDER BY UPPER(CONCAT(GE_USER.LNAME,GE_USER.FNAME))

Now when i go to add distinct in that qwuery, it will not work.

SELECT DISTINCT GE_USER.LNAME||', '||GE_USER.FNAME
FROM MSA.DE_ACCOUNT_EXEC DE_ACCOUNT_EXEC, MSA.DE_DEAL_HDR DE_DEAL_HDR, MSA.GE_USER GE_USER, MSA.GE_USER_JOB GE_USER_JOB
WHERE DE_DEAL_HDR.DEAL_ID = DE_ACCOUNT_EXEC.DEAL_ID AND GE_USER.GAB_ID = DE_ACCOUNT_EXEC.GAB_ID AND GE_USER.GAB_ID = GE_USER_JOB.GAB_ID AND ((GE_USER_JOB.JOB_ID=1))
ORDER BY UPPER(CONCAT(GE_USER.LNAME,GE_USER.FNAME))

Am i doing something wrong here?

Replies continue below

Recommended for you

RE: Cannot use DISCTINCT command when combining to columns in my query????

Try this: SELECT DISTINCT CONCAT(x,y) ..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close