Wocommerce PHP – MYSQL Get sets of values of products and variations variation exists

I am having a nightmare with getting data in the format I need using mysql/php. I have a query which gives me all the details I need for a product, but this also feeds me the main product details for a variable product.

I have tried and tried to make a simple query to just get variation details but for some reason getting no luck.

My aim is to get a the details for each product, and then all the same details for the variation IF the product has a variation – and if it has a variation, I do not need the main product for it, just the variations details.

Below is my query to get the details I want for a product but, I can not get the variations details no matter what I do. Can anyone help?

    SELECT ID, post_title, guid, post_type, sku_meta.meta_value AS `SKU`, 
stock_meta.meta_value AS 'QTY', 
salesprice_meta.meta_value AS 'SALEPRICE', 
ean_meta.meta_value AS 'EAN',
regularprice_meta.meta_value AS 'RRP'
FROM wp_posts
LEFT JOIN wp_postmeta sku_meta on wp_posts.ID = sku_meta.post_id
  AND sku_meta.meta_key = '_sku'
  LEFT JOIN wp_postmeta stock_meta on wp_posts.ID = stock_meta.post_id
  AND stock_meta.meta_key = '_stock'
  LEFT JOIN wp_postmeta salesprice_meta on wp_posts.ID = salesprice_meta.post_id
  AND salesprice_meta.meta_key = '_price'
  LEFT JOIN wp_postmeta ean_meta on wp_posts.ID = ean_meta.post_id
  AND ean_meta.meta_key = '_global_unique_id'
  LEFT JOIN wp_postmeta regularprice_meta on wp_posts.ID = regularprice_meta.post_id
  AND regularprice_meta.meta_key = '_regular_price'
WHERE post_type = 'product'