sql strange, VSTUDIO and V4MD 4.3

Christian - ChrisKatDev.com christian at chriskatdev.com
Mon Jun 14 07:28:01 CDT 2010


Le 14 juin 2010 à 13:25, Ivan Smahin a écrit :

> Hello Christian,
Hello Ivan,
> 
> Monday, June 14, 2010, 2:02:17 PM, you wrote:
> 
> 
>> Le 14 juin 2010 à 08:50, Ivan Smahin a écrit :
> 
>>> Hello Christian,
>> Hi Yvan,
>>> 
>>> Sunday, June 13, 2010, 5:28:18 PM, you wrote:
>>> 
>>>> ok only in Director...
>>> 
>>> BTW, this issues is fixed already
>>> http://www.valentina-db.com/bt/view.php?id=4930
>>> 
>>> 
>>>> 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 ?
>>> 
>>> 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;
> 
>> in this example, I have only 3 records, but, in practice, I can have 10000 records !!
>> I only want save my order...
> 
> And  you  do something like "...IN (7, 23, 1, ... thousand times ...)"
> ???
> 
> It would be pretty slow query...
no, it's ok if you have only one or two fields (38850 records, time < 500 ms)
> 
> Ok, how do you know that you need exactly such order - 7, 23, 1 ...?

pertinence (my previous demand)
I have a table for calculate pertinence and after, I search the real data, but I want this in order of pertinence

> I  guess  you  get  that  recIDs from another queries. So you might do
> something like this:
> 
> select recID, scrap from tableScrap where recID IN ( select RecID from
> tableScrap where <your conditions>)

No, I have recID in value
> 
> or even redesign it to join which is more speedy in most cases.
> 
> Anyway sort order in the result is undefined following sql-standard.
> Valentina  do  a  lot  of tricks to run the query as fast as possible.
> Some of them based on idea of undefined order.
> 
> To  get  some  particular order you should use "order by" clause.

and order by "respect of IN condition" ?

br
Christian
> 
> 
> -- 
> Best regards,
> Ivan Smahin 
> Senior Software Engineer
> Paradigma Software, Inc
> Valentina - The Ultra-Fast Database
> http://www.valentina-db.com
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina



More information about the Valentina mailing list