Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to come up with a view/CA model
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01410693
Message ID:
01410732
Vues:
24
>>>
>>>*** SelectCmd
>>>SELECT ISNULL(YourTable.OptionID,?m.selOptionID) AS OptionID,
>>>       ISNULL(YourTable.MakeId  ,?m.selMakeID)  AS lMakeID,
>>>       ISNULL(YourTable.ModelId  ,Models.Id)    AS ModelId,
>>>            rest of the fields
>>>FROM YourTable
>>>FULL JOIN Models ON YourTable.ModelId = Models.Id AND CHARINDEX([_]+CAST(Models.Id as varchar(20))+[_] , ?m.lcModels) > 0
>>>WHERE YourTable.OptionID = ?m.selOptionID AND
>>>             YourTable.MakeId   = ?m.selMakeID   AND
>>>            CHARINDEX([_]+CAST(YourTable.ModelId as varchar(20))+[_], ?m.lcModels) > 0
>>>
>>>m.selOptionID = 1
>>>m.selMakeID  = 12
>>>lcModels       = "_1_7_12_225_"
>>>
>>
>>
>>SELECT ISNULL(YourTable.OptionID,?m.selOptionID) AS OptionID,
>>>       ISNULL(YourTable.MakeId  ,?m.selMakeID)  AS lMakeID,
>>>       ISNULL(YourTable.ModelId  ,Models.Id)    AS ModelId,
>>>            rest of the fields
>>>FROM Models LEFT JOIN myTable on Models.ID = myTable.ID and myTable.MakeID = ?lnMakeID
>> where cast(Models.ModelID as varchar(20)) $ ?lcModels
>
>
>??????????
>No. WHERE clause should be in WHERE not in JOIN
>BTW isn't it SQL Server?
>And not LEFT but FULL join.

VFP table. And I think the last select I posted should do it.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform