Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View design
Message
 
 
À
22/01/2011 04:48:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01496981
Message ID:
01496987
Vues:
55
>Hi,
>Here's a very simplified version of a view (named History):
SELECT Id, Date,
>FROM  dbo.SCHeaders
>UNION
>Select Id, Date
>FROM dbo.Allocations
>UNION
>SELECT Id, Date
>FROM dbo.Detail
The view will always be used with a specific ID e.g :
>SELECT * FROM History WHERE ID='Fred'
>In this scenario there will always be only one record retrieved from the SCHeaders table.
>I need to exclude any records with a date that is earlier than that of the SCHeaders record from the result.
>FWIW this only need apply to the Detail table - there will be no such records in the Allocations table.
>
>A Sproc could be used if it is preferable....
>TIA

Do an inner join and include the date condition in the Where clause?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform