sql strange, VSTUDIO and V4MD 4.3

Ivan Smahin ivan_smahin at paradigmasoft.com
Wed Jun 9 09:36:07 CDT 2010


Hello Christian,

Wednesday, June 9, 2010, 5:13:42 PM, you wrote:



> BTW the workaround is -

> Group all the records you want and sum pertinence.
> Something like this:

> SELECT
>        idScrap, 
>        SUM(pertinence) as s 
> FROM 
>        kw_in_scrap
> WHERE 
>                kw = 'musique' 
>        OR  kw = 'cuivre' 
> GROUP BY
>        idScrap
> ORDER BY 
>        s DESC             


> This request doesn't match what I'm expecting for.

> In fact, I want to find idscrap which has kw1 AND kw2 and I want to
> have the addition of pertinence of kw1 and pertinence of kw2 for this idscrap.
> I don't want idscrap which has only one of the kw and I don't want the global sum of pertinence.
>                                      

ok - another workaround is:

select idScrap, a1+a2
from
(       
SELECT 
        t1.idScrap, 
        t1.pertinence a1,
        t2.pertinence a2
FROM 
        kw_in_scrap as t1, 
        kw_in_scrap as t2 
WHERE 
                t1.kw = 'musique' 
        and t2.kw = 'cuivre' 
        and t1.idScrap = t2.idScrap
)
ORDER BY 
        2 DESC                                                  





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