Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select items used before a date but not after
Message
From
04/05/2016 20:36:18
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01635849
Message ID:
01635850
Views:
68
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform