Basic SQL.
First part, add the keyword DISTINCT to your query thus: "SELECT DISTINCT...."
Second part, might as well join the two tables. I'll just make up names for some of the tables and fields.
The first table is called categories, and has two fields, id and catname. Maybe some more fields. Looks something like this:
id | catname
---+--------
1 | trucks
2 | bikes
...
Second table is called machines. Important is the cat_id field.
Now you want to match catnames from the categories table with the cat_ids in the machines table.
A SQL query which does this would be
SELECT c.catname, m.afield, m.anotherfield FROM categories c, machines m WHERE m.cat_id=c.id (and whatever other conditions apply)
where afield and anotherfield are of course the fields from the machines table you're interested in.