Get all Products from WooCommerce Database

I had to export all the products from the WordPress Database for a eCommerce project recently which used WooCommerce – An awesome product I must add! All I needed was some of the key information (Excluding review data etc. ) Just a very quick snippet for those who may come across the same issue :)!

<br />
SELECT<br />
     /** Post ID **/<br />
     p.id,<br />
     /** Product Code **/<br />
     mt.meta_value AS sku,<br />
     /** Product Stock **/<br />
     m.meta_value AS stock,  <br />
     /** Item Title **/<br />
     p.post_title AS title,<br />
     /** Item Description **/<br />
     p.post_content AS description,<br />
     /** Item Price **/<br />
     pt.meta_value AS price,<br />
     /** Item Weight **/<br />
     wt.meta_value AS weight<br />
FROM<br />
     wp_posts p<br />
INNER JOIN wp_postmeta m ON (<br />
     p.id = m.post_id<br />
)<br />
INNER JOIN wp_postmeta mt ON (<br />
     p.id = mt.post_id<br />
)<br />
INNER JOIN wp_postmeta pt ON (<br />
     p.id = pt.post_id<br />
)<br />
INNER JOIN wp_postmeta wt ON (<br />
     p.id = wt.post_id<br />
)<br />
WHERE<br />
 p.post_type = 'product'<br />
AND<br />
 m.meta_key = '_stock'<br />
AND<br />
 mt.meta_key = '_sku'<br />
AND<br />
 pt.meta_key = '_price'<br />
AND<br />
 wt.meta_key = '_weight'<br />