Welcome Guest, Not a member yet? Register   Sign In
MYSQL Help Please.
#1

[eluser]Atrhick[/eluser]
hey ladies/gentlemen i am trying to do something simple, but i cant get a handle on it.. I am trying to combine these two query's

This one
Code:
SELECT afid_seller_name, count( 1 ) 'Count', sum( price_buyer_paid ) 'Payout', sum( price_CIQFY_paid ) 'Cost', sum( price_buyer_paid - price_CIQFY_paid ) 'Profit'
FROM lead_partners_pages
WHERE date_month = MONTH( NOW( ) )
AND afid_seller_name != 'CIQFY'
GROUP BY afid_seller_name
ORDER BY Count DESC

And this one
Code:
SELECT afid_seller_name, count( 1)'Pings'
FROM auto_pings
WHERE date_month = MONTH( NOW( ) )
AND afid_seller_name !='CIQFY'
GROUPBY afid_seller_name
ORDERBY Count DESC

please help me. Thank you in advance
#2

[eluser]Krystian[/eluser]
from these SELECT statements we can see that these two tables

- lead_partners_pages
- auto_pings

you can connect it via afid_seller_name <- i guess

so,

Code:
SELECT *
FROM lead_partners_pages pages JOIN auto_pings pings ON pages.afid_seller_name = pings.afid_seller_name

I don`t exactly know what you want to get but you can easily extend this script




Theme © iAndrew 2016 - Forum software by © MyBB