[SQL] Bug with DISTINCT?

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Jan 16 00:11:33 CST 2004


on 1/15/04 11:53 PM, Eric Forget at forgete at cafederic.com wrote:

> Hi,
> 
> I created one Table A with one field s1 (string[20]) with those values:
> 
>   '2004-01-15'
>   '2004-01-14'
> 
> With the following query:
> 
>   Select RecID from A where s1 < '2004-01-15'
> 
> The result is:
> 
>   RecID
>   2
> 
> Which is fine. However with the query:
> 
>   Select DISTINCT RecID from A where s1 < '2004-01-15'
> 
> The result is empty. I believe it should have returned the same thing with
> this data. I've tried it with Vstudio.

Eric,

Please note,

RecID field not works correctly if you use it in ORDER BY.

Because sorting on RecID was not made.
Mainly because I did think this is not needed.

DISTINCT also works on SORT.
I think this explain your result.

---
Exists simple workaround.
Make BaseObject method of ULONG type which = RecID

This BaseObject methods will work with sorting.
Although it will add one index to table.


-- 
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