Woocommerce: Any way to list all products *without* a specific attribute?

I’ve had to do something similar recently, create a list of all attributes by product and product variation.

I used SQL to produce the list. It’s a bit basic and I’m sure could be improved easily.

SELECT  wp_posts.id,wp_woocommerce_attribute_taxonomies.attribute_id, wp_woocommerce_attribute_taxonomies.attribute_name,wp_woocommerce_attribute_taxonomies.attribute_label, wp_posts.post_type, wp_posts.post_title FROM wp_woocommerce_attribute_taxonomies,wp_posts WHERE wp_posts.post_type="product_variation" OR wp_posts.post_type="product"

I hope that helps, or points you in the right direction

Cheers

David