By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,851 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,851 IT Pros & Developers. It's quick & easy.

Syntax question DB2 UDB v8.1.9 Linux

P: n/a
The following query gives a syntax error if the 't1' is omitted, even
though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1

Apr 12 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Bob Stearns wrote:
The following query gives a syntax error if the 't1' is omitted, even
though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1

Seems to work fine for me on one of my tables ... which version of DB2
are you using?
You may want to try ") AS T1"?
Apr 12 '06 #2

P: n/a
In article <K2***********@fe05.lga>, rs**********@charter.net says...
The following query gives a syntax error if the 't1' is omitted, even
though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1


"select count(distinct birth_date) from is3.animals" should work also.
Apr 12 '06 #3

P: n/a
Gert van der Kooij wrote:
In article <K2***********@fe05.lga>, rs**********@charter.net says...
The following query gives a syntax error if the 't1' is omitted, even
though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1

"select count(distinct birth_date) from is3.animals" should work also.

Thanks, I'd overlooked that. An unavoidable result of the manual's being
about features and not combinations thereof.
Apr 12 '06 #4

P: n/a
Bob [IBM] wrote:
Bob Stearns wrote:
The following query gives a syntax error if the 't1' is omitted, even
though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1

Seems to work fine for me on one of my tables ... which version of DB2
are you using?
You may want to try ") AS T1"?

Bob, which platform supports omission of the table alias?
I take any excuse to remove it (It can be annoying)

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Apr 12 '06 #5

P: n/a
Bob Stearns wrote:
The following query gives a syntax error if the 't1' is omitted, even
though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1


DB2 requires that you give such derived tables a name. That's just the way
it is, and there isn't really a problem with that, is there?

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Apr 12 '06 #6

P: n/a
Serge Rielau wrote:
Bob [IBM] wrote:
Bob Stearns wrote:
The following query gives a syntax error if the 't1' is omitted,
even though it is never referenced. Could someone explain wy to me?

select count(*)
from ( select distinct birth_date
from is3.animals) t1

Seems to work fine for me on one of my tables ... which version of
DB2 are you using?
You may want to try ") AS T1"?

Bob, which platform supports omission of the table alias?
I take any excuse to remove it (It can be annoying)

Cheers
Serge

Well duh on me -- I reversed the reading of the post! Never mind my
reply -- it is off kilter and today so am I.
Thanks for catching that Serge.
Apr 12 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.