I’ve got a MS SQL 2008 table called “fruits” that looks like this:
id name category_id
-- ------------ -----------
1 Apples 4
2 Bananas 6
3 Crackers 6
and another table called “categories” with:
id category_name
-- -------------
4 Foo
6 Bar
How do I produce a query that will return results that look like:
fruit_name fruit_category_name
---------- -------------------
Apples Foo
Bananas Bar
Crackers Bar
(The columns must be exactly that name because I’m trying to write a CSV.)
1 Answer