John,
I'm not sure what you mean by "Also if the key is used in other tables they can used along with OrdItems right?" but about the short names, it would look like this:
SELECT Short.Field1, Short.Field2 ;
FROM ReallyReallyReallyLong AS Short ;
WHERE Short.Field3 = ...
>I figured the 'AS' was optional. With Ed's code I was able to remove the 'o1' and 'o2' and it ran fine w/o. So where elsewhere, if my statement was more complex, would they be referenced? Also if the key is used in other tables they can used along with OrdItems right? Haven't tested it yet but I will today.
>
>
>>Ed's "O1" and "O2" have Oh's not zeroes. Starting with a digit would generate an error. Another way to express this is
>>
FROM OrdItems AS O1
and it means that there is less to type elsewhere in the SELECT statement. Personally, I'm for long names as otherwise I am always looking back to see which table we mean, but if you are using different DBC's you could have
really long names.
>>
>>You can have as many ANDs and ORs in your WHERE clause as you need. Use parens to force them to be evaluated correctly, or simply for ease in understanding what's going on.
>
>>>>
SELECT * FROM Orders ;
>>>> INTO CURSOR Temp ;
>>>> WHERE OrdID IN (SELECT OrdID FROM OrdItems O1 WHERE item = 'hammer') ;
>>>> AND OrdID IN (SELECT OrdID From OrdItems O2 WHERE item = 'nails')