A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Distinctrow



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2009, 01:54 PM posted to microsoft.public.access.queries
ann
external usenet poster
 
Posts: 462
Default Distinctrow

I'm trying to get only the distinct rows for the following but it doesn't
work. What am I doing wrong? Thanks for any help you can provide.

SELECT DISTINCTROW tblDRSJobs.txtDRSMonth, tblDRSJobs.txtDRSNumber,
Nz(([curFirstClassPostageRate]*[sngQuantity])+[curDeliveryCost],0) AS
curUSPSPostageCost, Nz([curUSPSPostageCost]-[curPostageStatementCost]) AS
[DiscountedPostageCost/Savings], tblDRSJobsByOperators.txtMachineType INTO
[tblDiscountedPostageCost/Saving]
FROM tblDRSJobs INNER JOIN tblDRSJobsByOperators ON tblDRSJobs.txtDRSNumber
= tblDRSJobsByOperators.txtDRSNumber
WHERE (((tblDRSJobsByOperators.txtMachineType)="SeCap" Or
(tblDRSJobsByOperators.txtMachineType)="Video Jet" Or
(tblDRSJobsByOperators.txtMachineType)="Offline" Or
(tblDRSJobsByOperators.txtMachineType)="DA95"));

  #2  
Old November 20th, 2009, 02:15 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Distinctrow

"doesn't work"? How exactly isn't it working as you expect? Returning dupes?
Not returning all the expected records?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Ann" wrote:

I'm trying to get only the distinct rows for the following but it doesn't
work. What am I doing wrong? Thanks for any help you can provide.

SELECT DISTINCTROW tblDRSJobs.txtDRSMonth, tblDRSJobs.txtDRSNumber,
Nz(([curFirstClassPostageRate]*[sngQuantity])+[curDeliveryCost],0) AS
curUSPSPostageCost, Nz([curUSPSPostageCost]-[curPostageStatementCost]) AS
[DiscountedPostageCost/Savings], tblDRSJobsByOperators.txtMachineType INTO
[tblDiscountedPostageCost/Saving]
FROM tblDRSJobs INNER JOIN tblDRSJobsByOperators ON tblDRSJobs.txtDRSNumber
= tblDRSJobsByOperators.txtDRSNumber
WHERE (((tblDRSJobsByOperators.txtMachineType)="SeCap" Or
(tblDRSJobsByOperators.txtMachineType)="Video Jet" Or
(tblDRSJobsByOperators.txtMachineType)="Offline" Or
(tblDRSJobsByOperators.txtMachineType)="DA95"));

  #3  
Old November 20th, 2009, 03:00 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Distinctrow

Perhaps you want DISTINCT instead of DistinctRow.

"...doesn't work..." is not very descriptive. It does not tell us if you are
getting the wrong results ( too many records, not enough records, no records)
or a syntax error of some kind, etc.

My basic question is why are you doing this make table query in the first
place. It is almost always (some exceptions do exist) the wrong choice to do
so. You are usually better off just using a select query to return the
results you need and use that as if it were a table.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Ann wrote:
I'm trying to get only the distinct rows for the following but it doesn't
work. What am I doing wrong? Thanks for any help you can provide.

SELECT DISTINCTROW tblDRSJobs.txtDRSMonth, tblDRSJobs.txtDRSNumber,
Nz(([curFirstClassPostageRate]*[sngQuantity])+[curDeliveryCost],0) AS
curUSPSPostageCost, Nz([curUSPSPostageCost]-[curPostageStatementCost]) AS
[DiscountedPostageCost/Savings], tblDRSJobsByOperators.txtMachineType INTO
[tblDiscountedPostageCost/Saving]
FROM tblDRSJobs INNER JOIN tblDRSJobsByOperators ON tblDRSJobs.txtDRSNumber
= tblDRSJobsByOperators.txtDRSNumber
WHERE (((tblDRSJobsByOperators.txtMachineType)="SeCap" Or
(tblDRSJobsByOperators.txtMachineType)="Video Jet" Or
(tblDRSJobsByOperators.txtMachineType)="Offline" Or
(tblDRSJobsByOperators.txtMachineType)="DA95"));

  #4  
Old November 20th, 2009, 08:25 PM posted to microsoft.public.access.queries
ann
external usenet poster
 
Posts: 462
Default Distinctrow

It repeats all the duplicate and triplicate records. I only want to see the
entire row once.

"Jerry Whittle" wrote:

"doesn't work"? How exactly isn't it working as you expect? Returning dupes?
Not returning all the expected records?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Ann" wrote:

I'm trying to get only the distinct rows for the following but it doesn't
work. What am I doing wrong? Thanks for any help you can provide.

SELECT DISTINCTROW tblDRSJobs.txtDRSMonth, tblDRSJobs.txtDRSNumber,
Nz(([curFirstClassPostageRate]*[sngQuantity])+[curDeliveryCost],0) AS
curUSPSPostageCost, Nz([curUSPSPostageCost]-[curPostageStatementCost]) AS
[DiscountedPostageCost/Savings], tblDRSJobsByOperators.txtMachineType INTO
[tblDiscountedPostageCost/Saving]
FROM tblDRSJobs INNER JOIN tblDRSJobsByOperators ON tblDRSJobs.txtDRSNumber
= tblDRSJobsByOperators.txtDRSNumber
WHERE (((tblDRSJobsByOperators.txtMachineType)="SeCap" Or
(tblDRSJobsByOperators.txtMachineType)="Video Jet" Or
(tblDRSJobsByOperators.txtMachineType)="Offline" Or
(tblDRSJobsByOperators.txtMachineType)="DA95"));

  #5  
Old November 20th, 2009, 09:32 PM posted to microsoft.public.access.queries
Bob Barrows
external usenet poster
 
Posts: 475
Default Distinctrow

Perhaps your definition of "distinct" isn't quite what the DISTINCT and
DISTINCTROW keywords are designed to provide. Could you show us some
examples of the duplicate records?

You can save us some time by providing the source records that produced the
resulting duplicates.


Ann wrote:
It repeats all the duplicate and triplicate records. I only want to
see the entire row once.

"Jerry Whittle" wrote:

"doesn't work"? How exactly isn't it working as you expect?
Returning dupes? Not returning all the expected records?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Ann" wrote:

I'm trying to get only the distinct rows for the following but it
doesn't work. What am I doing wrong? Thanks for any help you can
provide.

SELECT DISTINCTROW tblDRSJobs.txtDRSMonth, tblDRSJobs.txtDRSNumber,
Nz(([curFirstClassPostageRate]*[sngQuantity])+[curDeliveryCost],0)
AS curUSPSPostageCost,
Nz([curUSPSPostageCost]-[curPostageStatementCost]) AS
[DiscountedPostageCost/Savings],
tblDRSJobsByOperators.txtMachineType INTO
[tblDiscountedPostageCost/Saving]
FROM tblDRSJobs INNER JOIN tblDRSJobsByOperators ON
tblDRSJobs.txtDRSNumber = tblDRSJobsByOperators.txtDRSNumber
WHERE (((tblDRSJobsByOperators.txtMachineType)="SeCap" Or
(tblDRSJobsByOperators.txtMachineType)="Video Jet" Or
(tblDRSJobsByOperators.txtMachineType)="Offline" Or
(tblDRSJobsByOperators.txtMachineType)="DA95"));


--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.