[Vserver+V4RB] Querying a table JOINed to itself

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Dec 13 18:02:50 CST 2004


On 12/13/04 5:49 PM, "Eric Ferrer" <wonderfef at noos.fr> wrote:

Hi Eric,

 
> 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
                        ^^^^^^^^^^^^^^^^^^^^^^^^ this is comment ?

Valentina not support comments in SQL query

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

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------




More information about the Valentina mailing list