Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / July 2006

Tip: Looking for answers? Try searching our database.

SQL Syntax Bug

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
In need of assistance - 17 Jul 2006 21:13 GMT
I'm writing a query and I'm getting a syntax error but I'm not seeing it
when I look at it and the error message isn't telling me where it is at.  For
starters, does anyone see my mistake, and better yet does anyone know of a
bug hunting software that will give better details as to where the bug is?

My query:

SELECT First([First Name]) AS [Family First Name],
First([Last Name]) AS [Family Last Name],
[Matchfield],
First([Weld Co ID]) AS [Family Address ID]

FROM [PrimaryVoterTier]

GROUP BY [Matchfield]

HAVING (((Count(*))=1));

UNION SELECT
First([First Name]) & " and " Last([First Name]) AS [Family First Name],
First([Last Name]) AS [Family Last Name],
[Matchfield],
First([Weld Co ID]) AS [Family Address ID]

FROM [PrimaryVoterTier]

GROUP BY [Matchfield]

HAVING (((Count(*)=2));

UNION SELECT
"The " & First([Last Name]) & " Family" AS [Family First Name],
" " AS [Family Last Name],
[Matchfield],
First([Weld Co ID]) AS [Family Address ID]

FROM [PrimaryVoterTier]

GROUP BY [Matchfield]

HAVING (((Count(*)>2));
Jeff Boyce - 17 Jul 2006 21:58 GMT
Do each of the separate queries within the union work correctly?  Confirm
this first, then assemble those back together.

Regards

Jeff Boyce
Microsoft Office/Access MVP

> I'm writing a query and I'm getting a syntax error but I'm not seeing it
> when I look at it and the error message isn't telling me where it is at.
[quoted text clipped - 38 lines]
>
> HAVING (((Count(*)>2));
Gary Walter - 17 Jul 2006 22:27 GMT
one thing:

the ";" are not allowed before the UNION's
--> delete them

"In need of assistance"wrote:
> I'm writing a query and I'm getting a syntax error but I'm not seeing it
> when I look at it and the error message isn't telling me where it is at.
[quoted text clipped - 38 lines]
>
> HAVING (((Count(*)>2));
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.