473,396 Members | 2,004 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,396 software developers and data experts.

Access allergic to certain subqueries?

Execution of the following statement sends Access into permanent la-la
land, but works fine in SQL Server on the same table:

SELECT *

FROM tblDailyProofTickets

WHERE TicketID NOT IN
(SELECT Keeper FROM
(SELECT MIN(A.TicketID) AS Keeper, SeqNbr
FROM tblDailyProofTickets AS A
GROUP BY A.SeqNbr)
AS KeepSet) ;

The subquery executes fine independently, but not as listed above.
Also, Access' query design view interpets the whole shebang with no
problems. Your thoughts?

Mark H.
Aug 7 '08 #1
5 2213
Ah, the dreaded correlated subquery. Access will eventually finish running
the query, but you might need to take your summer vacation whilst it does
so.

"Element" <mh*****@lotuscreek.comwrote in message
news:75**********************************@34g2000h sh.googlegroups.com...
Execution of the following statement sends Access into permanent la-la
land, but works fine in SQL Server on the same table:

SELECT *

FROM tblDailyProofTickets

WHERE TicketID NOT IN
(SELECT Keeper FROM
(SELECT MIN(A.TicketID) AS Keeper, SeqNbr
FROM tblDailyProofTickets AS A
GROUP BY A.SeqNbr)
AS KeepSet) ;

The subquery executes fine independently, but not as listed above.
Also, Access' query design view interpets the whole shebang with no
problems. Your thoughts?

Mark H.

Aug 7 '08 #2
On Aug 7, 9:05*am, "bcap" <b...@nospam.nowherewrote:
Ah, the dreaded correlated subquery. *Access will eventually finish running
the query, but you might need to take your summer vacation whilst it doesso.
I see -- and so I shall use a join instead (at least there's an
alternative).

Come to think of it, I prefer joins better anyway.

Thanks for the reply.

Aug 7 '08 #3
JOINs will be faster.

Access is not great at subqueries. You seem to be comfortable with SQL, but
you might get a laugh from some of these generic suggestions for Access
anyway:
Surviving Subqueries
at:
http://allenbrowne.com/subquery-02.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Element" <mh*****@lotuscreek.comwrote in message
news:2a**********************************@z72g2000 hsb.googlegroups.com...
On Aug 7, 9:05 am, "bcap" <b...@nospam.nowherewrote:
Ah, the dreaded correlated subquery. Access will eventually finish running
the query, but you might need to take your summer vacation whilst it does
so.
I see -- and so I shall use a join instead (at least there's an
alternative).

Come to think of it, I prefer joins better anyway.

Thanks for the reply.

Aug 7 '08 #4
On Aug 7, 10:19*am, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
Surviving Subqueries at: http://allenbrowne.com/subquery-02.html
A very complete treatment of the subject in the Access world, thanks
for the link.

I should also note -- as most of you probably already know -- that
many times the need for a subquery points to deficiencies in the SQL
language, not as much to a problem with a specific database engine.
Maybe someday the SQL committee will wake up and come up with a real
revamp, not what we got with SQL-99 -- esp. multi-valued
fields...yikes.
Mark H.
Aug 8 '08 #5
On Aug 8, 8:42*am, lyle fairfield <lyle.fairfi...@gmail.comwrote:
I don't see this as a deficiency in any SQL language but a deficiency
in the Access query dialog/wizard.
Just to clarify -- I originally wrote the query in a SQL text editor,
not Access' query builder. I ended up manually converting it to a join
and it worked expediently...which, again, is preferable to the IN
(subquery) deal anyway.

I definitely agree that Access has its own specific deficiencies with
query processing, but some of them wouldn't be a problem to solve in
the first place if SQL were a better language. SQL is still the best
thing we have, but there seems to have been no motivation over the
past 15 years for the major DB vendors to truly improve it by making
it more relational and have a more consistent syntax (e.g. QUEL). They
obviously have other fad-driven priorities like XML support (yuck) and
creating things like LINQ (puke), instead of increasing the leveraging
of logic and set mathematics.

Well, I suppose this thread is leaning heavily towards
comp.databases.theory now :)
Aug 8 '08 #6

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

Similar topics

1
by: russ | last post by:
Hi I need some advice about ms-access limitations. i have some databases written by others i have been working with that keeps crashing. different on different computers, so it sounds like a...
4
by: thecrew | last post by:
I need help converting this statement to work with access 2000 SELECT COUNT(DISTINCT s.supercatID) AS num FROM supercat s WHERE s.supercatID IN (SELECT p.supercatID from Products p WHERE...
5
by: mathieu.page | last post by:
Hi, I often have recursives queries in my applications, like in this simplified example : req1 : SELECT EmployeNo, EmployeName, EmployePhone FROM Employe; req2 :
10
by: Hank | last post by:
We have just recently migrated the data from our Access 2000 backend to Postgres. All forms and reports seem to run correctly but, in many cases, very slowly. We do not want to switch over until...
43
by: sinister | last post by:
Is MS Access a true RDBMS?
1
by: timn | last post by:
Translating Access SQL queries into SQL subqueries. -------------------------------------------------------------------------------- I have a query in Access that uses a subquery, I would like...
4
by: muzu1232004 | last post by:
Can anyone explain me when we use correlated subqueries rather than nested subqueries. Do all the correlated subqueries can be written in nested subqueries form as well ? What are the major...
0
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some...
1
NeoPa
by: NeoPa | last post by:
Access QueryDefs Mis-save Subquery SQL Access stores its SQL for Subqueries in a strange manner :s It seems to replace the parentheses "()"with square brackets "" and (often) add an extraneous...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
Oralloy
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,...
0
jinu1996
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...
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
agi2029
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,...

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.