Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select items used before a date but not after
Message
De
05/05/2016 02:30:21
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01635849
Message ID:
01635857
Vues:
47
>>>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')
>>
>
>
>Thank you very much. I think you have a typo above where you typed 'pf.park_used' where it should be 'pf.part_pk'. Otherwise, no errors.
>I will test it against my database.

Ops! Sorry, but you spotted it pronto, so no problem...
----------------------------------
António Tavares Lopes
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform