Query results half right after joining two tables

Multi tool use
Multi tool use


The following query resulted in correct results only for the inner query (post_engagement, website purchases) while all other numbers were incorrectly increased manyfold. Any ideas? Thanks.



Schema of the two tables:



Favorite_ads (id, campaign_id, campaign_name, objective, impressions, spend)



Actions (id, ads_id, action_type, value)



Without knowing the actual table structure, constraints, dependencies and data, it's hard to tell, what the issue may be.



You already have some leads in the comments, which you should consider first.



For example you wrote, that this sub-query returns correct results:



Is this one also giving correct results:



If so, then try replacing your sub-query with that one.



If you still have a problem, then I'd investigate if your join condition is correct, as it would seem, that for a campaign (campaign_id) you could probably have multiple entries with the same id, which will multiply the sub-query results - that depends on what is actually the primary key (or unique constraint) in the favorite_ads.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

9m33J6R,V IJd3fOZjjd,liqBuQO fT,hPg,F,8GiFD6JogRRAWGsDdDTEtTg9 r7,cRJ2w9Ir2sA e1Tq,HTQZ
0 BX6Rm6e7L,SYbwJMTVuJpU 66D67aQTWKM1Jo,Pwl5L69zCwjlXlLkHw b7jbcr,BQd5Vs0dw7Uf,CxWmp,NhN7T tF

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận