How to retrieve elements from another table in a SQL query?
SELECT 
p.ID, 
p.post_title, 
ProductImage1.product_img1, 
ProductImage2.product_img2, 
ProductImage3.product_img3 
FROM wp_posts p 
cross apply (
        select top(1) pi1.product_img1 
        from wp_postmeta pi1  
        where p.ID = pi1.post_id
        and pi1.meta_key = 'product_img1'
        ) as ProductImage1
cross apply (
        select top(1) pi2.product_img2 
        from wp_postmeta pi2  
        where p.ID = pi2.post_id
        and pi2.meta_key = 'product_img2'
        ) as ProductImage2
cross apply (
        select top(1) pi3.product_img1 
        from wp_postmeta pi3  
        where p.ID = pi3.post_id
        and pi3.meta_key = 'product_img3'
        ) as ProductImage3
WHERE p.post_type = 'wpcproduct'
AND p.ID = 103