[Vserver+V4RB] Querying a table JOINed to itself

Eric Ferrer wonderfef at noos.fr
Mon Dec 13 16:49:05 CST 2004


Hello all,

Maybe my db strucure is poorly designed, but ...

I have a PriceLists table that contains BOTH
PriceLists Name
And
Articles Prices

I have also an Articles table.

I'd like to query the database to search displayable PriceLists name and the
corresponding prices

Here what I'm trying to do :

SELECT
N.Name, P.Price
FROM
PriceLists N,
PriceLists P
WHERE
N.Owners LIKE 'TV'   ''this is specific to my app
AND
N.ParentPriceListID = ''      '' to get price list name
AND
N.ID *= P.ParentPriceListID
AND
P.ParentArticleID = '123ABC'

I'd need the cursor to display 0.00 if no record found for one of the price
lists, i.e :

SOME ARTICLE NAME HERE
2005 price:                 0 (not yet stored)
2004 price:             200
2003 Price:             159

But I can't make this work.
Thanks in advance for your help.
Eric




More information about the Valentina mailing list