sql strange, VSTUDIO and V4MD 4.3

Ivan Smahin ivan_smahin at paradigmasoft.com
Mon Jun 14 03:53:00 CDT 2010


Hello Ruslan,

Monday, June 14, 2010, 11:21:45 AM, you wrote:

> On 6/14/10 9:50 AM, "Ivan Smahin" <ivan_smahin at paradigmasoft.com> wrote:

>>> but I have other problem :
>> 
>>> I have, for example,
>> 
>>> "select recID, scrap from tableScrap where recID IN (7, 23, 1)"
>> 
>>> but I want records IN ORDER of "IN" : 7, 23, 1 and not 1, 7, 23
>> 
>>> do you have a solution ?

> I wonder guys.

> "select recID, scrap from tableScrap where recID IN (7, 23, 1)"

> Don't return records in that order 7 23 1    ???

> Ivan?

> Well, may be bitsets are used ...
Exactly.


>> select recID, scrap from tableScrap where recID = 7
>> UNION
>> select recID, scrap from tableScrap where recID = 23
>> UNION
>> select recID, scrap from tableScrap where recID = 1;

It should be "UNION ALL" instead of "UNION".
Because  "UNION" produces unique result, so it will be sorted in order
to find duplicates and will generate 1,7,23 rows in a result.


 select recID, scrap from tableScrap where recID = 7
 UNION ALL
 select recID, scrap from tableScrap where recID = 23
 UNION ALL
 select recID, scrap from tableScrap where recID = 1;


-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list