473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Query grouping problem

jag
Hi

i have a drill hole geology table with information as follows

holeid depthfrom depth to plot1

hwrc1 0 1 cuf
hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i would like to composite the geology to get the following

hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i have a query where i have grouped by 'holeid' and 'plot1' and min of
'depth from' and max of 'depth to'

this query retrieves the following

hwrc 1 6 cuf
hwrc 2 4 cup
how can i retrieve the correct data without overlapping depth intervals?

thanks

dee


-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com

Nov 13 '05 #1
5 1575
jag wrote:
Hi

i have a drill hole geology table with information as follows

holeid depthfrom depth to plot1

hwrc1 0 1 cuf
hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i would like to composite the geology to get the following

hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf
From your example I would exclude all records with 0 in the DepthFrom
field. That will work.

If this is a sample and my solution will not work, you are SOL.

IOW, you need to redefine your logic and add another field. As you add
records into a batch, run a sub/function that sets groups/breakpoints.
Maybe a field called Sequence. I see no other way based on the info you
have in this question.

i have a query where i have grouped by 'holeid' and 'plot1' and min of
'depth from' and max of 'depth to'

this query retrieves the following

hwrc 1 6 cuf
hwrc 2 4 cup
how can i retrieve the correct data without overlapping depth intervals?

thanks

dee


Nov 13 '05 #2
"jag" <md**@benet.net.au> wrote in message
news:40********@quokka.wn.com.au...
Hi

i have a drill hole geology table with information as follows

holeid depthfrom depth to plot1

hwrc1 0 1 cuf
hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i would like to composite the geology to get the following

hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i have a query where i have grouped by 'holeid' and 'plot1' and min of
'depth from' and max of 'depth to'

this query retrieves the following

hwrc 1 6 cuf
hwrc 2 4 cup
how can i retrieve the correct data without overlapping depth intervals?

if the core intervals are contiguous, (i.e. "depth from" for the scceeding
interval always equals "depth to" for the preceeding interval) you can do:

select holeid, min(depthfrom) as depFrom,
max(depthto) as depTo, prevPlot AS plot
from
(
select b1.holeid, b1.depthfrom, b1.depthto, b1.plot1,
nz (
(
select b2.plot1
from boreholes as b2
where b2.holeid = b1.holeid
and b2.depthto = b1.depthfrom
),b1.Plot1
) as prevPlot
from boreholes as b1
) as A
group by holeid, plot1, prevplot
order by holeid, min(depthfrom)

If the intervals are not contiguous then you need to make them so with e.g.
a separate table of hole depths in metres. Alternatively, get your boss to
buy a good core-logging program :-)




Nov 13 '05 #3
Dee,

I create applications that integrate a Palm Pilot with Access. The Palm Pilot
is programmed for data entry and after data is entered in the Palm Pilot, the
Palm Pilot is synchronized to an Access database and the data entered in the
Palm Pilot is transferred to the Access database. You could take your Palm Pilot
to the field, enter your field data and after returning to your office, transfer
the data to your database. Email me at my email address below if you are
interested.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"jag" <md**@benet.net.au> wrote in message news:40********@quokka.wn.com.au...
Hi

i have a drill hole geology table with information as follows

holeid depthfrom depth to plot1

hwrc1 0 1 cuf
hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i would like to composite the geology to get the following

hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i have a query where i have grouped by 'holeid' and 'plot1' and min of
'depth from' and max of 'depth to'

this query retrieves the following

hwrc 1 6 cuf
hwrc 2 4 cup
how can i retrieve the correct data without overlapping depth intervals?

thanks

dee


-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com

Nov 13 '05 #4
"PC Datasheet" <no****@nospam.spam> wrote in message
news:wr*****************@newsread2.news.atl.earthl ink.net...
Dee,

I create applications that integrate a Palm Pilot with Access. The Palm Pilot is programmed for data entry and after data is entered in the Palm Pilot, the Palm Pilot is synchronized to an Access database and the data entered in the Palm Pilot is transferred to the Access database. You could take your Palm Pilot to the field, enter your field data and after returning to your office, transfer the data to your database. Email me at my email address below if you are
interested.

Way to go Steve.

Not only do you *not* answer the guys question, (because, of course, you
can't), you also use the opportunity to send an unsolicited advertisement
for a service he didn't request.
--
p.s. Note to dee. I would avoid this guy like the plague. His knowlege of
Access is about on a par with his knowlege of diamond drilling.

Nov 13 '05 #5
jag
Yes John the intervals are contiguous.
Thankyou , I will try this out
Dee

--
-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com
"John Winterbottom" <as******@hotmail.com> wrote in message
news:2j*************@uni-berlin.de...
"jag" <md**@benet.net.au> wrote in message
news:40********@quokka.wn.com.au...
Hi

i have a drill hole geology table with information as follows

holeid depthfrom depth to plot1

hwrc1 0 1 cuf
hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i would like to composite the geology to get the following

hwrc1 1 2 cuf
hwrc1 2 4 cup
hwrc1 4 6 cuf

i have a query where i have grouped by 'holeid' and 'plot1' and min of
'depth from' and max of 'depth to'

this query retrieves the following

hwrc 1 6 cuf
hwrc 2 4 cup
how can i retrieve the correct data without overlapping depth intervals?
if the core intervals are contiguous, (i.e. "depth from" for the scceeding
interval always equals "depth to" for the preceeding interval) you can do:

select holeid, min(depthfrom) as depFrom,
max(depthto) as depTo, prevPlot AS plot
from
(
select b1.holeid, b1.depthfrom, b1.depthto, b1.plot1,
nz (
(
select b2.plot1
from boreholes as b2
where b2.holeid = b1.holeid
and b2.depthto = b1.depthfrom
),b1.Plot1
) as prevPlot
from boreholes as b1
) as A
group by holeid, plot1, prevplot
order by holeid, min(depthfrom)

If the intervals are not contiguous then you need to make them so with

e.g. a separate table of hole depths in metres. Alternatively, get your boss to
buy a good core-logging program :-)



Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Debbie Davis | last post by:
Hi there, SQL 2000 I have the following query: SELECT sponsor, COUNT(sponsor) * 2 AS total FROM Referrals GROUP BY sponsor Works great, returns the sponsor and the total * 2 of their...
5
by: Jerome | last post by:
Hi, I've got the following problem: I want my ASP page to display a certain number (based on a COUNT query), it works fine if the result is at least 1! If there are no records to be counted...
9
by: cyrus.kapadia | last post by:
Let's say I have the following table: entry product quality 1 A 80 2 A 70 3 A 80 4 B 60 5 B 90 6 ...
4
by: Orion | last post by:
Hi, This is kind of last minute, I have a day and a half left to figure this out. I'm working on a project using ms-sqlserver. We are creating a ticket sales system, as part of the system, I...
7
by: jane | last post by:
HI, I was ask to do a query to get the member active condition I had table to show the member number and active status in three month. ACC A1 A2 A3 ---- -----------...
4
by: Philippe | last post by:
Hello, I encounter a problem that I cannot solve myself... The problem is the following: I make a table: several records: the first field is always a number, the following field is always...
5
by: Terri | last post by:
The following query will give me the top ten states with the most callers. SELECT TOP 10 Count(Callers.CallerID) AS CountOfCallerID, Callers.State FROM Callers GROUP BY Callers.State ORDER BY...
1
by: Regnab | last post by:
I often want to query the database with certain parameters in my query which I do not want included in the query result. The problem is when I want to group on 1, sum the 2nd (and group by) and...
24
by: clare at snyder.on.ca | last post by:
I have a SQL query I need to design to select name and email addresses for policies that are due and not renewed in a given time period. The problem is, the database keeps the information for every...
4
by: lorirobn | last post by:
Hi, I have a report displaying items that are missing from a room. I created 2 queries, the first getting the items IN the room, and the second being an "unmatched" query that references the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.