Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Some Help with Select statement
Message
 
À
22/09/2003 08:58:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00830332
Message ID:
00831053
Vues:
17
>>>Caroline,
>>>Probably you wouldn't want to use "IN (...)", due to its limitation, right ?
>>>Assuming you first would want to get paper IDs into a cursor. ie:
>>>
>>>
>>>Create Cursor crsPapers (ItemID i)
>>>Insert into crsPapers values (1)
>>>Insert into crsPapers values (2)
>>>
>>>* ItemId 1 is The Times
>>>* ItemId 2 is The Sunday Times
>>>Select CustID from Subs s ;
>>>  left join crsPapers p on s.ItemID = p.ItemID ;
>>>  having cnt(s.ItemID) = Reccount('crsPapers') and ;
>>>	cnt(s.ItemID) = cnt(p.ItemID) ;
>>>  group by custID
>>>
>>>With an IN (lcList) it might be :
>>>
>>>
>>>* ItemId 1 is The Times
>>>* ItemId 2 is The Sunday Times
>>>lcList = '1,2'
>>>Select CustID from Subs s ;
>>> left join Papers p ;
>>> on s.ItemID = p.ItemID and p.ItemId in (&lcList) ;
>>> having cnt(s.ItemID) = Occurs(',',m.lcList)+1 and ;
>>>	cnt(s.ItemID) = cnt(p.ItemID) ;
>>> group by custID
Cetin
>>
>>Thanks Cetin that seems to work. I've just got to incorporate the new cursor into my code then I'm away.
>>Many thanks
>>Caroline
>
>Glad:) If that would be a view I think you could make that cursor parametric. ie:
>
>
>&& In command window
>Create Cursor crsPapers (ItemID i)
>Insert into crsPapers values (1)
>Insert into crsPapers values (2)
>
>m.crsPapers = 'crsPapers'
>
>create sql view as v_subs as ;
>Select CustID from Subs s ;
>  left join ?crsPapers p on s.ItemID = p.ItemID ;
>  having cnt(s.ItemID) = Reccount(?crsPapers) and ;
>	cnt(s.ItemID) = cnt(p.ItemID) ;
>  group by custID
>
>* Then once created
>m.crsPapers = sys(2015)
>select ItemID from Papers where ... into cursor (m.crsPapers) nofilter
>
>use myDB!v_subs && or requery if in use
>
Would work I 'guess' :)
>Cetin
>
>
Actually it not a view but a search query.
Caroline
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform