I am using the below query and for some reason, when I add in the pubid it drops records from my output list. Maybe someone can tell me how it's written wrong.
The above runs fine, outputting all the desired records, when I add l.pubid right before the MAX(l.quantity) there are records being dropped.
What my desired output is, one record for each customer, the max quantity for any pub they desire (that is in the "display" list, and then also i need to see the pubid for the one that is selected as the max quantity.
ok, hopefully that wasn't to confusing. thanks for the help.
Code:
SELECT c.custnumber, c.custtype, c.firstname, c.middleinitial, c.lastname, c.companyname, c.department, c.region, c.street1, c.street2, c.city, c.state, c.zipcode, c.zip4, c.country, c.countrycode, MAX(l.quantity) FROM `moms_customer` c, `moms_lists` l WHERE c.custnumber = l.custnumber AND l.pubid IN (".$_POST['display'].") GROUP BY l.custnumber
The above runs fine, outputting all the desired records, when I add l.pubid right before the MAX(l.quantity) there are records being dropped.
What my desired output is, one record for each customer, the max quantity for any pub they desire (that is in the "display" list, and then also i need to see the pubid for the one that is selected as the max quantity.
ok, hopefully that wasn't to confusing. thanks for the help.