php - get product price based on customer code -
my product table looks
id type product code product name price 1 customers 56620000 product 219.68 € 2 customers 56621000 product b 4,351.91 € 3 customers 56622000 product c 110.98 € 4 155000 56622000 product c 100.00 € 5 customers 56626000 product d 2,410.38 € 6 customers 56772000 product e 100.00 € 7 160000 56772000 product e 90.00 €
if notice row 3,4 , 6,7 has same product code different type , price. means product can have price customer few specific customers. if customer customer id 155000 performs search product code 56622000, customer price 100.00 € (see row number 4) not 110.98 € (see row number 3). if same customer performs search product code 56772000, he/she price 100.00 €(see row number 6) not 90.00 €(see row number 7). because there no specific price user product code 56772000.
my query: how execute operation using php , mysql single table.?
select * product productcode = 'x' , type in ('y', 'all customers') order field(type, 'y', 'all customers') limit 1
replace x
, y
desired value shown in demo.
Comments
Post a Comment