Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
SELECT POLE.BILLING_WA , POLE.ST_LITE_TY , Sum(POLE.QTY_LI GHTS) AS
SumOfQTY_LIGHTS , POLE.TOWN, Streetlight_Acc ounts.Account
FROM Streetlight_Acc ounts RIGHT JOIN POLE ON Streetlight_Acc ounts.Town
= POLE.TOWN
GROUP BY POLE.BILLING_WA , POLE.ST_LITE_TY , POLE.TOWN,
Streetlight_Acc ounts.Account, POLE.ST_LTOWNER , POLE.QTY_LIGHTS
HAVING (((POLE.TOWN)<> 'LOB' And (POLE.TOWN)<>'p ort sy') AND
((POLE.ST_LTOWN ER)<>'MTO') AND ((POLE.QTY_LIGH TS)>="1"))
ORDER BY POLE.BILLING_WA ;
Craig 6 7002
Craig,
The issue is most likely that you have a difference in one of the other
grouped fields that is causing you to retuen multiple rows for the same
billing wattage. If you have two different ST_LITE_TY, you will get
two rows even if BILLING_WA is the same for each. To eliminate this
type of problem, you have to remove any other extraneous field values
that are not pertinent to your query. If you don't really want
differentiation by ST_LITE_TY or some of your other fields, like TOWN
ro Account, then you should remove these from the query SELECT
statement and GROUP BY clause and use a WHERE clause rather than a
HAVING clause to limit the results by those fields removed from the
SELECT clause. This change should give you the result you want without
additional groupings.
- GH
On Nov 29, 10:46 am, craig.buchin... @gmail.com wrote:
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
SELECT POLE.BILLING_WA , POLE.ST_LITE_TY , Sum(POLE.QTY_LI GHTS) AS
SumOfQTY_LIGHTS , POLE.TOWN, Streetlight_Acc ounts.Account
FROM Streetlight_Acc ounts RIGHT JOIN POLE ON Streetlight_Acc ounts.Town
= POLE.TOWN
GROUP BY POLE.BILLING_WA , POLE.ST_LITE_TY , POLE.TOWN,
Streetlight_Acc ounts.Account, POLE.ST_LTOWNER , POLE.QTY_LIGHTS
HAVING (((POLE.TOWN)<> 'LOB' And (POLE.TOWN)<>'p ort sy') AND
((POLE.ST_LTOWN ER)<>'MTO') AND ((POLE.QTY_LIGH TS)>="1"))
ORDER BY POLE.BILLING_WA ;
Craig
BILLING_WA ST_LITE_TY SumOfQTY_LIGHTS TOWN Account
0 MV 3
BB 72414
0 MV 2 BB 72414
Here is a snipit of the output... i don't understand why it's not
grouping the MV's and adding the sum of lights together.
Craig
GH wrote:
Craig,
The issue is most likely that you have a difference in one of the other
grouped fields that is causing you to retuen multiple rows for the same
billing wattage. If you have two different ST_LITE_TY, you will get
two rows even if BILLING_WA is the same for each. To eliminate this
type of problem, you have to remove any other extraneous field values
that are not pertinent to your query. If you don't really want
differentiation by ST_LITE_TY or some of your other fields, like TOWN
ro Account, then you should remove these from the query SELECT
statement and GROUP BY clause and use a WHERE clause rather than a
HAVING clause to limit the results by those fields removed from the
SELECT clause. This change should give you the result you want without
additional groupings.
- GH
On Nov 29, 10:46 am, craig.buchin... @gmail.com wrote:
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
SELECT POLE.BILLING_WA , POLE.ST_LITE_TY , Sum(POLE.QTY_LI GHTS) AS
SumOfQTY_LIGHTS , POLE.TOWN, Streetlight_Acc ounts.Account
FROM Streetlight_Acc ounts RIGHT JOIN POLE ON Streetlight_Acc ounts.Town
= POLE.TOWN
GROUP BY POLE.BILLING_WA , POLE.ST_LITE_TY , POLE.TOWN,
Streetlight_Acc ounts.Account, POLE.ST_LTOWNER , POLE.QTY_LIGHTS
HAVING (((POLE.TOWN)<> 'LOB' And (POLE.TOWN)<>'p ort sy') AND
((POLE.ST_LTOWN ER)<>'MTO') AND ((POLE.QTY_LIGH TS)>="1"))
ORDER BY POLE.BILLING_WA ;
Craig
<cr************ *@gmail.comwrot e in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
Grouping in a report always overrides the query. Use sorting and grouping
in the report.
Regards,
Keith. www.keithwilby.com
There is no way to group these records in the query?
Craig
Keith Wilby wrote:
<cr************ *@gmail.comwrot e in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
Grouping in a report always overrides the query. Use sorting and grouping
in the report.
Regards,
Keith. www.keithwilby.com
If I were to hazard a guess, one of these two field groupings is
creating your record differences: POLE.ST_LTOWNER , POLE.QTY_LIGHTS .
Since you are summing QTY_LIGHTS, why are you grouping on it?
- GH
On Nov 29, 11:30 am, craig.buchin... @gmail.com wrote:
There is no way to group these records in the query?
Craig
Keith Wilby wrote:
<craig.buchin.. .@gmail.comwrot e in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
Grouping in a report always overrides the query. Use sorting and grouping
in the report.
Regards,
Keith. www.keithwilby.com- Hide quoted text -- Show quoted text -
Thanks a lot.. Got it working..i can't believe i missed that..
Thanks again
Craig..
GH wrote:
If I were to hazard a guess, one of these two field groupings is
creating your record differences: POLE.ST_LTOWNER , POLE.QTY_LIGHTS .
Since you are summing QTY_LIGHTS, why are you grouping on it?
- GH
On Nov 29, 11:30 am, craig.buchin... @gmail.com wrote:
There is no way to group these records in the query?
Craig
Keith Wilby wrote:
<craig.buchin.. .@gmail.comwrot e in message
>news:11******* *************** @j72g2000cwa.go oglegroups.com. ..
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i
have written a query for a report to pull out our streetlights and
group them by billing wattage. The problem is that it is counting the
number of lights and summing them like i have asked, but in some cases
there are more then one row with a different sum but the same billing
wattage. Here is my SQL query. I'm trying to group by billing wattage
so all the unique billing wattages are together. Thanks in advance!
Grouping in a report always overrides the query. Use sorting and grouping
in the report.
Regards,
Keith.
>www.keithwilby.com- Hide quoted text -- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paxton |
last post by:
Hi,
I'm trying to display the total page views per page within a given date
range, but the correct SQL is seemingly beyond me. I get the correct result
with a straightforward Group By and Count clause eg
SELECT DISTINCT tblPageViews.PageVisited,
Count(tblPageViews.PageVisited) AS CountOfPageVisited
FROM tblPageViews
GROUP BY...
|
by: Robert |
last post by:
Hello Accessors
I have some reports created in Access that are very good for what they do.
However, it seems to me that when you are displaying information you don't
need to print out that a printer-friendly report is not the best way to go.
So, I tried converting one of my Access reports to an Access form. I
selected the continuous view...
|
by: Bob |
last post by:
Hi Everybody
Difficult question
Has anyone else used the "Using the Tab control as a container"
database example that comes with the above book chapter 7 on the
accompanying disc. It is a brilliant piece of design that I have used
in 2 previous projects and they have worked beautifully.
What it does is set up the tabs in a container...
|
by: Mike MacSween |
last post by:
tblCourses one to many to tblEvents.
A course may have an intro workshop (a type of event), a mid course
workshop, a final exam. Or any combination. Or something different in the
future.
At the moment the printed output is usually going to Word. It's turning into
an unholy mess, because I'm having to prepare umpteen different Word...
|
by: ApexData |
last post by:
I have one table used to maintain information on Service Events.
Each record contains a Repair, Maint, and Battery checkbox
(bound/boolean). Any one of these fields may be checked or left empty.
Ex. REPAIR=True, MAINT=False, BATTERY=True
I want to generate ONE report that lists all the REPAIRS, then lists
all the MAINT, and then lists all...
| |
by: Hexman |
last post by:
Hello All,
How do I limit the number of detail records selected in a Master-Detail set using SQL?
I want to select all master records for a date, but only the first 3 records for the details (based on the primary key of the detail record). I've
been trying with "TOP 3", but can't get anywhere. Using Access 2000.
Something like:
...
|
by: lupo666 |
last post by:
Hi everybody, this time I have three problems driving me nuts :-(((
(1)
I have a report with 20 or so Yes/No "squares". Is there a way to
either hide/show the "square" or change the yes/no relative textbox,
depending on value?
(2)
|
by: prakashwadhwani |
last post by:
Hi !! I'm about to develop a new project for a client.
Should I go about it in Access 2003 or 2007 ? Purchasing it either
for me or for my client is not a major consideration here ... what I'd
like to know is the stability, speed & ease of use of both the
products.
I believe Access 2007 has a new file format too and that it may be...
|
by: zandiT |
last post by:
hello everyone
when working with access reports using the grouping sections, how do you change the title of the group header section depending on which group is being displayed. i have a report that groups depending on a field called TypeOfReporting. It can either be Complete or Edit. i used the sorting and grouping functionality and it groups...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |