UNION query 
Author Message
 UNION query

Why can't I create a UNION query from the SQL design grid in 2000 like I did
in 97:

IOW:

this worked in 97:  TABLE Qry_1 UNION TABLE Qry_2 but fails in access2000
when I try to run it with the "invalid SQL statement; expected 'DELETE',
'INSERT' " etc.

Thanks!

--
Bill

PhotoSourceFolio webmaster
http://www.*-*-*.com/



Sat, 21 Dec 2002 03:00:00 GMT  
 UNION query
Hmm.... I've never defined UNION queries that way. In fact, I'm pretty sure
that _that's_ an invalid syntax, but I'll leave it up for a SQL guru like
Vanderghast to
help me on.

The correct syntax, or at least the way most of us define UNION queries is
to specify the fields, either with a wildcard "*" or the specific fields
themselves.

SELECT OrderID from Orders
Union
Select OrderID from [Order Details]

 -- Dev


: Why can't I create a UNION query from the SQL design grid in 2000 like I
did
: in 97:
:
: IOW:
:
: this worked in 97:  TABLE Qry_1 UNION TABLE Qry_2 but fails in access2000
: when I try to run it with the "invalid SQL statement; expected 'DELETE',
: 'INSERT' " etc.
:
: Thanks!
:
: --
: Bill

: PhotoSourceFolio webmaster
: http://www.photosourcefolio.com
:
:



Sat, 21 Dec 2002 03:00:00 GMT  
 UNION query

Hi,

Dev... Me, Guru? Well, if YOU finally admit YOU are one too, and only at
that condition!   :-)

TABLE tableName
UNION ALL
TABLE OtherTableName

is also a valid syntax. In fact, "TABLE TableName" can be use instead of
"SELECT * FROM TableName"... but the syntax SELECT tableName.. it doesn't
work in Access 97 either.

Vanderghast, Access MVP.


Quote:
> Hmm.... I've never defined UNION queries that way. In fact, I'm pretty
sure
> that _that's_ an invalid syntax, but I'll leave it up for a SQL guru like
> Vanderghast to
> help me on.

> The correct syntax, or at least the way most of us define UNION queries is
> to specify the fields, either with a wildcard "*" or the specific fields
> themselves.

> SELECT OrderID from Orders
> Union
> Select OrderID from [Order Details]

>  -- Dev



> : Why can't I create a UNION query from the SQL design grid in 2000 like I
> did
> : in 97:
> :
> : IOW:
> :
> : this worked in 97:  TABLE Qry_1 UNION TABLE Qry_2 but fails in
access2000
> : when I try to run it with the "invalid SQL statement; expected 'DELETE',
> : 'INSERT' " etc.
> :
> : Thanks!
> :
> : --
> : Bill

> : PhotoSourceFolio webmaster
> : http://www.photosourcefolio.com
> :
> :



Sun, 22 Dec 2002 03:00:00 GMT  
 UNION query
Hi Michel,


: Hi,
:
: Dev... Me, Guru? Well, if YOU finally admit YOU are one too, and only at
: that condition!   :-)

LOL... :-)

:
: TABLE tableName
: UNION ALL
: TABLE OtherTableName
:
:
: is also a valid syntax. In fact, "TABLE TableName" can be use instead of
: "SELECT * FROM TableName"... but the syntax SELECT tableName.. it doesn't
: work in Access 97 either.
:

Cool... I didn't know that.  Thanks for the info.

  -- Dev



Sun, 22 Dec 2002 03:00:00 GMT  
 UNION query
Yeah, well I though I was pretty good until I started coming in here.  =)

Quick personal... where do you guys work (if I can ask), and what do ya'll
do for a living?  Access I presume?

-- jb


Quote:

> Hi,

> Dev... Me, Guru? Well, if YOU finally admit YOU are one too, and only at
> that condition!   :-)

> TABLE tableName
> UNION ALL
> TABLE OtherTableName

> is also a valid syntax. In fact, "TABLE TableName" can be use instead of
> "SELECT * FROM TableName"... but the syntax SELECT tableName.. it doesn't
> work in Access 97 either.

> Vanderghast, Access MVP.



> > Hmm.... I've never defined UNION queries that way. In fact, I'm pretty
> sure
> > that _that's_ an invalid syntax, but I'll leave it up for a SQL guru
like
> > Vanderghast to
> > help me on.

> > The correct syntax, or at least the way most of us define UNION queries
is
> > to specify the fields, either with a wildcard "*" or the specific fields
> > themselves.

> > SELECT OrderID from Orders
> > Union
> > Select OrderID from [Order Details]

> >  -- Dev



> > : Why can't I create a UNION query from the SQL design grid in 2000 like
I
> > did
> > : in 97:
> > :
> > : IOW:
> > :
> > : this worked in 97:  TABLE Qry_1 UNION TABLE Qry_2 but fails in
> access2000
> > : when I try to run it with the "invalid SQL statement; expected
'DELETE',
> > : 'INSERT' " etc.
> > :
> > : Thanks!
> > :
> > : --
> > : Bill

> > : PhotoSourceFolio webmaster
> > : http://www.photosourcefolio.com
> > :
> > :



Sun, 22 Dec 2002 03:00:00 GMT  
 UNION query


: Yeah, well I though I was pretty good until I started coming in here.  =)
:
: Quick personal... where do you guys work (if I can ask),

I work for a MS Solution Provider/Partner.

: and what do ya'll
: do for a living?  Access I presume?

Nope, not me.  I do front-ends (ASP/JScript) and middle-tier (VB).

 -- Dev



Sun, 22 Dec 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How to Format Date in Union Query.

2. How to format Union Query

3. Union query gives 'Too few parameters'

4. Union Query problem

5. Dates and union queries

6. Union Query with Memo Field

7. Union query + subreport = Slow

8. Union Queries and OpenRecordSet Method

9. Problem sorting a UNION query with Oracle

10. UNION query is not working...

11. I need help with Union query in VB

12. Insert Into with a Select Union query

 

 
Powered by phpBB® Forum Software