This might be what you are looking for, but I have not fully tested it:

CREATE CURSOR Stock;
(cCode c(3),;
cDesc c(20))

INSERT INTO Stock (cCode, cDesc) VALUES ("100", "book")
INSERT INTO Stock (cCode, cDesc) VALUES ("100", "+book")
INSERT INTO Stock (cCode, cDesc) VALUES ("101", "paper")
INSERT INTO Stock (cCode, cDesc) VALUES ("102", "pen")
INSERT INTO Stock (cCode, cDesc) VALUES ("102", "+pen")
INSERT INTO Stock (cCode, cDesc) VALUES ("103", "stamp")
INSERT INTO Stock (cCode, cDesc) VALUES ("104", "brush")

SELECT Stock.cCode, Stock.cDesc ;
    FROM Stock ;
        INNER JOIN (SELECT cCode, COUNT(cCode) as Dups ;
                    FROM stock ;
                    GROUP BY cCode ;
                    HAVING Dups > 1) DupCodes ON Stock.cCode = 
DupCodes.cCode


free...@sohocare wrote:
> dear all GURU,
>
> Can anyone help me on how to use "SELECT * from stock .." command to get the 
> following result?
>
> STOCK.DBF
> code   description
> 100     book
> 100     +book
> 101     paper
> 102     pen
> 102     +pen
> 103     stamp
> 104     brush
>
>
> RESULT:   (List of duplicate code)
> code   description
> 100     book
> 100     +book
> 102     pen
> 102     +pen
>
>
> TIA
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
>   text/plain (text body -- kept)
>   text/html
> ---
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to