I've read about this elusive beast but I've never been able to get it to work. There's hardly ANY information about it on the mySQL website so I wanted to have a thread here where someone knowledgable about database dev could give me a definitive answer on how and when to use it. Do you use it in the SELECT portion of your SQL? The WHERE? The ORDER BY? I can't beleive that something that could be so uesful is almost completely neglected on the mySQL website.
I'll start off by posting a query that I'm trying to get working with CASE.
At this point my query returns 3 rows. Two of those rows have 2 records each that return empty strings. I'd like to replace those empty strings with the letters "EMC". Obviously I could use CFIF statements to replace them but I really want to learn more SQL so I'm asking this question now.
SELECT p.prod_dateadded, CONCAT(m.mfr_name, ' ', p.prod_name) AS product, c.company_name, u.user_name
FROM tblmanufacturers m
INNER JOIN tblproducts p
ON m.mfr_id = p.fk_mfr_id
LEFT OUTER JOIN tbluser u
ON u.user_id = p.fk_user_id
LEFT OUTER JOIN tblcompany c
ON c.company_id = u.fk_company_id
WHERE prod_dateadded BETWEEN '2004-11-01' AND '#DateFormat(Now(),"yyyy-mm-dd")#'
ORDER BY product
Does anyone have any thoughts?