Re: beginners querying question

From: Niko Schwarz <niko_at_schwarz.nu>
Date: Mon, 27 Aug 2001 21:40:35 +0200
Message-ID: <9me7mn$1n364$1_at_ID-42792.news.dfncis.de>


Jan Hidders wrote:

>> grp[|pricing ::= MIN(pricing)](Articles) join[pricing](Articles)
>> 
>> is this possible? or reasonable? isnt there another... you know, a cuter
>> way to do that? if this would work, it would seem to me like the dirtiest
>> hack on world =)

 [...]
> But in most extensions I've seen your solution is possible, and I would
> also say that it is reasonable. Keep in mind that the join is an
> abstract operation that is not necessarily implemented with a nested
> loop. So the expression does not imply that you are iterating over the
> same table twice. I assume that is why you feel it is a "hack".

umm, i used the join only, because i did not figure how to use the result of the grp (the computed pricing field), as a variable.

meanwhile i read on, and i found an example that tells better the part i dont understand:

| article | pricing | stock |


thats the three domains in the tupel, now: i want all the articles, that have a higher pricing than the most expensive article in stock 7.

what i would have to do now is to save the most expensive item in a variable, and this does not seem to be possible by the notation my book gives.

after some hard tries, i thought a work-around might work about the "full outer join".

the thing ive written down looks now like this, but this time im almost sure it does not work:

sel[pricing > max_pricing] (

        (grp[|max_pricing ::= MAX(pricing)](
                sel[store = 7](Article)
        ) join*[]*(Articel))

)

the idea: i copy the max pricing to any tupel of the relation and then i can compare in a simple sel statement.

the problem: ive got no idea if an outer join really works like this, and to be honest: using a true variable would look much more performant to me...

regards,

nick

-- 
Marriage is the only adventure open to the cowardly.
                -- Voltaire
Received on Mon Aug 27 2001 - 21:40:35 CEST

Original text of this message