Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread GROUP BY
Sun, Jul 21 2013 4:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I can do

select _forename from contacts
group by _surname

IE group by is not in select clause

or

select (Select _Surname from contacts where contacts._id = _fkContacts) as fred,* from career
group by
fred

IE group by is in select clause

but not

select * from career
group by
(Select _Surname from contacts where contacts._id = _fkContacts)

or

select * from career
group by
(Select _Surname from contacts where contacts._id = _fkContacts) as fred

IE group by not in select clause


which strikes me as inconsistent. Its the same for ORDER BY. Is there a reason?

Roy Lambert
Sun, Jul 21 2013 10:53 AMPermanent Link

Terry Swiers

Hi Roy,

> Is there a reason?

In your first two examples, Fred resolves down to a field name.  In your
last two examples, your group by clause resolves to a result set, which you
can't use for an order by.

---------------------------------------
Terry Swiers
Millennium Software, Inc.
http://www.1000years.com
http://www.atrex.com
---------------------------------------

Sun, Jul 21 2013 11:15 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Terry

>In your first two examples, Fred resolves down to a field name. In your
>last two examples, your group by clause resolves to a result set, which you
>can't use for an order by.

I accept part of what you're saying Smiley

However,

(Select _Surname from contacts where contacts._id = _fkContacts)

is a result set as much in the select clause as in the group by clause. The only difference a mere mortal like myself can spot is that in the select clause I've given it a nice easy to use reference aka a correlation name.

I suppose the real difference is that in

select (Select _Surname from contacts where contacts._id = _fkContacts) as fred,* from career
group by
fred

I've specified I want to see it, but then that doesn't stack up with the first example (it used to in DBISAM). I presume its just another of those stupid things in the standard I disagree with, dislike and have no chance of changing Frown

Roy
Sun, Jul 21 2013 2:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< which strikes me as inconsistent. Its the same for ORDER BY. Is there a
reason? >>

No, it's just a limitation in EDB.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jul 22 2013 3:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

><< which strikes me as inconsistent. Its the same for ORDER BY. Is there a
>reason? >>
>
>No, it's just a limitation in EDB.

Guess what I'm going to say next <vbg>

Roy
Image