Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select items used before a date but not after
Message
De
04/05/2016 20:36:18
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01635849
Message ID:
01635850
Vues:
65
This message has been marked as a message which has helped to the initial question of the thread.
>I am working on a SQL Select where result is parts/items used prior to a certain date but not used after this date. Here is my attempt which does not seem to work
>
>
>select * from part_file where part_pk in (select part_pk from part_used
>where used_date !> '20100101' and used_date < '20100101')
>
>
>How do I need to change the above SQL Select?
SELECT pf.*
  FROM part_file pf ;
    INNER JOIN part_used pu ON  pu.part_pk = pf.park_used AND pu.used_date < '20100101'
  WHERE pf.part_pk NOT IN (SELECT part_pk FROM park_used WHERE used_date > '20100101')
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform