Request SQL

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Mar 25 08:27:42 CST 2004


On 3/25/04 6:46 AM, "Thierry Nauze" <huancaya at wanadoo.fr> wrote:

> Hello,
> 
> In broad outline, I have a table with two fields
> 
> FieldA     FieldB
> a        A
> b         A
> c         B
> d         A
> e         C
> f         B
> 
> Which request SQL (SELECT ...), if it is possible, it is necessary to
> use to obtain a cursor containing only the records where the
> occurrences of FielsB are multiple:
> a        A
> b         A
> c         B
> d         A
> f         B


SELECT fa, fb, count(fb) as c
FROM T
WHERE c > 1
GROUP BY fb, fa

Although this is not very effective
    (GROUP BY on 2 fields, and not needed group by on fa)

But this even not works in Valentina 1.x


You can do instead something as

SELECT fa, fb, count(fb)
FROM T
GROUP BY fb, fa
ORDER BY 3 DESC

Now records that have count(fb) will be last in the cursor.
You can ignore them by your code,
Or you can make loop to DropRecord() them from cursor.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list