?
Solved

Mircosoft Jet SQL and SELECT DISTINCT

Posted on 2004-03-29
2
Medium Priority
?
539 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
michaelbartolotta earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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