[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] RE: Count of only one instance



Well....fundamentally your approach should work out....without the specifics
of the tables and the keys that you are using in the query it wont be
possible to pinpoint where you are erroring out.

I would use a condition much similar to what you have used like -
----and 1<= (select count(*) from table_name b where b.account_cd =
a.account_cd )

Hope it helps.

Regards,
Jiju.


On 8/28/06, White . Denise <DWhite@drc.com> wrote:
>
> Since this is the SQR user group, I assume you are writing an SQR
> program.  Therefore, it is not necessary to do everything in a single
> SQL statement.  I think that the way I would approach this is to select
> all of the data I need from the other tables, except for that in the
> table that you are looking for the single row count from.  Then, do a
> call to a second procedure that will select from that table, keeping a
> count at the same time, and only print if the count returned is 1.
>
> Denise M. White
> EBS Programmer/Analyst III
> Dynamics Research Corporation
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 25 Aug 2006 11:08:21 -0500
> From: "Brooke Funk" <Brooke.Funk@firstfedbankkc.com>
> Subject: [sqr-users] Count of only one instance
> To: <sqr-users@sqrug.org>
> Message-ID:
>        <b94b85ba189b9f0bf06cab02a2a6369b44ef20c8@firstfedbankkc.com>
> Content-Type: text/plain; charset=US-ASCII
>
> I am drawing a blank on how to find where only one instance in a table
> exists.  There are some accounts that have multiple rows but I am
> looking for only those that have only one row in the table.  I have
> tried grouping with the count (*) = 1 but it is returning accounts that
> have more than 1 row in it.  Can someone help me out?  I can say what I
> want but in writing it in SQL it's not working.  I have several other
> columns from different tables I am pulling but I want only those
> accounts that have only 1 instance in this particular table regardless
> of multiple rows in other existing tables I am pulling from.
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
>

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users