I need to produce the following:
Comp No Year Purchased
=========================
11111 2008
22222 2007
33333 2008
44444 2006
But I need to exclude some results based on a concatenated name. And I can't have the name listed in the result. This is my code:
SELECT
Comp_Num,
YEAR (Comp_PurchaseDate) AS 'Year Purchased',
CONCAT(Emp_First, ' ', Emp_Last) as 'Name'
FROM Computer
JOIN Hire using (Comp_Num)
JOIN employee using (Emp_Num)
ORDER BY Comp_Num;
It produces:
Comp No Year Purchased Name
================================
11111 2008 AAA
22222 2007 BBB
33333 2008 CCC
44444 2006 DDD
The concatenated name is used to filter out results, eg:
WHERE ('Name' <> 'AAA' AND
Name' <> 'DDD')
How do I create the concatenated name to filter out results without displaying the column? The concatenate doesn't work without "as 'name' ".
And how do I use the concatenated name to filter? Can I still use Where? Or is there another clause?