Solved

Mircosoft Jet SQL and SELECT DISTINCT

Posted on 2004-03-29
2
526 Views
Last Modified: 2012-05-04
Hey,

got a quick(hopfully) question. I have a need to do a distinct select statment, how ever all the documents that i have googled for seem to be giving me the wrong info.

I have been trying to do a:

SELECT DISTINCT Purchaser_Seller FROM Transactions WHERE TransType='Purchase';

however it doesn't work when i try to shove it through Microsoft Jet. When i try it just in access it askes for a value for Purchaser_Seller. If i enter in a number it just returns the number. Or if i type in somthing like 'asdf' it returns four rows all with asdf in them. Every document that i have read has giving me the idea that this should work. I did read some posts on EE and they suggested somthing different which i tryed but only got a sytax error. Heres what the posts suggested:

SELECT DISTINCT CAST (Purchaser_Seller varchar(50)) FROM Transactions WHERE TransType='Purchase';

Does anybody have any ideas to why nether of these seem to work, or an idea that would point me in the right direction. A quick response would be great because i am working on a bit of a deadline. Thanks for any help that you guys can offer in advance.

-Pizentios
0
Comment
Question by:Pizentios
2 Comments
 
LVL 2

Accepted Solution

by:
michaelbartolotta earned 500 total points
ID: 10707747
Well, your syntax looks correct.
If Access is asking for a value for Purchaser_Seller, that's telling me that you don't have a field Purchaser_Seller in the Transactions table, so Access is assuming it to be a parameter. Check your spelling.
From your code, the table Transactions should contain a column Purchaser_Seller and another column TransType.
If that's not the case, let's take a closer look at what you're trying to accomplish and see if we can't solve it together.
Don't be afraid to put more detail in your question, there's no space limit here and the more you put the quicker and more completely we can answer you.
-MiKe
0
 

Author Comment

by:Pizentios
ID: 10708155
your right about the spelling, i was one letter wrong on Purchaser_Seller. In the db it was labeled wrong, thanks for the help, i feel kinda stupid now..heh

-Pizentios
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now