Q:

Query that will match a non-unique id if there is data in two separate columns across multiple rows

I'm stuck trying to figure out how to extract data from a single table. What I need a query that will match an id (non-unique) if there is data in two separate columns across multiple rows. Here is an example of the data.
+---------+---------------+-----------+
|     id  |  Drivers      | Brands    |
+---------+---------------+-----------+
|    1    |               |  Brands   |
|    2    |   Drivers     |           | 
|    3    |   Drivers     |           | 
|    1    |   Drivers     |           | 
|    4    |               | Brands    | 
|    2    |   Drivers     |           | 
|    3    |               | Brands    | 
|    4    |               | Brands    | 
+---------+---------------+-----------+

Id 1 and 3 are the only rows that contain values in both Drivers and Brands. This is the data I need.
Few things about the data:

There will never be a row with both Drivers and Brands.
Its possible an id will have multiple rows with just Driver or just Brands (cant use count to determine a match).

A:

You can do a GROUP BY. Use the HAVING clause to return ID's that have both driver and brand values:
select id
from tablename
group by id
having count(drivers) > 0 and count(brands) > 0

Alternatively, use INTERSECT:
select id from tablename where drivers is not null
intersect
select id from tablename where brands is not null

INTERSECT returns the two selects' common rows, and removes duplicates.

