user4fun Posted September 28, 2009 Report Share Posted September 28, 2009 I need to write a query statment that will do the following$sql1="Select PK_BusinessID FROM tblBusiness where FK_AccountID ='$ses_var_PKAccountID' ";The trick is I want to find the SUM(Max_Ad_Pts) FROM tblAd for every PK_BusinessID that is found from $sql1 and just return one results $total_Max_Pts.I would apprecaite any help I can get.Thank you Link to comment Share on other sites More sharing options...
justsomeguy Posted September 28, 2009 Report Share Posted September 28, 2009 $sql1="SELECT SUM(Max_Ad_Pts) FROM tblAd WHERE PK_BusinessID IN (Select PK_BusinessID FROM tblBusiness where FK_AccountID ='$ses_var_PKAccountID') "; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now