Article View: borland.public.interbase.sql
Article #10980Re: Pre-compile error problem
From: Wayne Niddery [TeamB]
Date: Thu, 02 Jan 2003 05:25
Date: Thu, 02 Jan 2003 05:25
27 lines
2349 bytes
2349 bytes
"The DeerBear" <rainaple@tin.it> wrote in message news:3e136cb9@newsgroups.borland.com... > > Just a note: where you mention "order by" are you meaning "group by"? No, group by is no good to you for that query. Order By will set the rows in a particular order, such as alphabetically by Roles if that's what you want. Group By would be if you want to "roll up" multiple rows into one. E.g. there are multiple roles per user but you only want to see each user name once. You can't do that here though because you want to see the Role Name with each user. If all you wanted was the user information and a *count* of that user's roles, then a group by is exactly what you would need here: select acc.user_id, acc.title, acc.first_name, acc.last_name, COUNT(r.user_role) from ACCOUNTS acc INNER JOIN ROLES r on r.user_id = acc.user_id where acc.user_id <> :user_id group by acc.user_id, acc.title, acc.first_name, acc.last_name -- Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com) "Democracy, without that guarantee of liberty, is merely a method of selecting tyrants." - Alan Nitikman
Technical Details
Message-ID:
<3e13cdff$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3e125625$1@newsgroups.borland.com> <3e132284$1@newsgroups.borland.com> <3e132369@newsgroups.borland.com> <3e134722$1@newsgroups.borland.com> <3e136cb9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,5649031f8df85db4 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2003-01-01 21:39:22 PST From: "Wayne Niddery [TeamB]" <wniddery@chaff.aci.on.ca> Newsgroups: borland.public.interbase.sql References: <3e125625$1@newsgroups.borland.com> <3e132284$1@newsgroups.borland.com> <3e132369@newsgroups.borland.com> <3e134722$1@newsgroups.borland.com> <3e136cb9@newsgroups.borland.com> Subject: Re: Pre-compile error problem Date: Thu, 2 Jan 2003 00:25:44 -0500 Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 209.50.82.158 Message-ID: <3e13cdff$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1041485311 209.50.82.158 (1 Jan 2003 21:28:31 -0800) X-Authenticated-User: wniddery Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail