We help IT Professionals succeed at work.
Get Started

access 2007 distinct query problem

sudif
sudif asked
on
1,021 Views
Last Modified: 2012-05-05
I want the query to return unique values for the field T_Beneficiary.Ben_CPR I tried distinct and didn't make any change.
group by doesn't work
what is the ideal solution
PARAMETERS [from] DateTime, [to] DateTime, company Text ( 255 );
SELECT CPP_Company.Cpy_Name, CPP_Company.Cpy_Adress, CPP_Company.Cpy_Tel, CPP_Company.Cpy_Fax, T_Beneficiary.Ben_CPR, T_Beneficiary.Ben_Name, T_InitialActivity.Act_Route, T_InitialActivity.Act_DtePI, [T_PI-LPOCpy2].ID_PILPO, [T_PI-LPOCpy2].PI_LPO_No, T_Pay_PI.Pay_No, T_Pay_PI.Pay_Amt, T_Pay_PI.Pay_Dte
FROM (CPP_Company INNER JOIN ((T_Beneficiary INNER JOIN [T_PI-LPOCpy2] ON T_Beneficiary.Ben_ID = [T_PI-LPOCpy2].PI_BenID) INNER JOIN T_InitialActivity ON T_Beneficiary.Ben_ID = T_InitialActivity.Act_Ben) ON CPP_Company.Cpy_ID = T_Beneficiary.Ben_Cpy) INNER JOIN T_Pay_PI ON [T_PI-LPOCpy2].ID_PILPO = T_Pay_PI.Pay_LPO_ID
WHERE (((CPP_Company.Cpy_Name)=[company]) AND (([T_PI-LPOCpy2].PI_LPODte)<[to] And ([T_PI-LPOCpy2].PI_LPODte)>[from]))
ORDER BY [T_PI-LPOCpy2].PI_LPO_No, T_Pay_PI.Pay_No, T_Pay_PI.Pay_Amt;

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE