Solved

Mircosoft Jet SQL and SELECT DISTINCT

Posted on 2004-03-29
2
536 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 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 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