query problem
Posted: Mon Feb 25, 2008 5:20 am
I am having a problem with query, I want to select max bid price, primary key, and FK_PRODUCT_ID against a user id. but i want to select row if and only if the user put max bid in other words i want to select max bid, product id, pkid against a user id if and only if he/she has given max bid on that product.
Here is db structure:
Here is db structure:
Code: Select all
CREATE TABLE `bids` (
`PK_ID` int(11) NOT NULL auto_increment,
`FK_USER_ID` int(11) default NULL,
`FK_PRODUCT_ID` int(11) default NULL,
`bid_price` float(11,0) default NULL,
`created_on` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`PK_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ;