ericsante Posted May 18, 2006 Share Posted May 18, 2006 I am building an auction administration site, I want to check the auction site for all the closed auctions for the user and compare this against the paid auction table and then display the items that need to be paid for.I have the SQL query to find the closed auctions, however I am having problems doing the compare against the paid auctions table.Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/9901-find-unpaid-items-logic/ Share on other sites More sharing options...
shocker-z Posted May 18, 2006 Share Posted May 18, 2006 we could really do with your table structure and an example line of data from the database as could be anything at the moment, so more info needed.RegardsLiam Quote Link to comment https://forums.phpfreaks.com/topic/9901-find-unpaid-items-logic/#findComment-36830 Share on other sites More sharing options...
ericsante Posted May 18, 2006 Author Share Posted May 18, 2006 TABLE `winners` ( `id` int(11) NOT NULL auto_increment, `auction` int(32) NOT NULL default '0', `seller` int(32) NOT NULL default '0', `winner` int(32) NOT NULL default '0', `bid` double NOT NULL default '0', `closingdate` timestamp(14) NOT NULL, `fee` double NOT NULL default '0', KEY `id` (`id`)) TYPE=MyISAM;TABLE `auctions` ( `id` int(32) NOT NULL auto_increment, `user` int(32) default NULL, `title` tinytext, `starts` varchar(14) default NULL, `description` text, `pict_url` tinytext, `category` int(11) default NULL, `minimum_bid` double(16,4) default NULL, `reserve_price` double(16,4) default NULL, `buy_now` double(16,4) default NULL, `auction_type` char(1) default NULL, `duration` varchar(7) default NULL, `increment` double(8,4) NOT NULL default '0.0000', `location` varchar(30) default NULL, `location_zip` varchar(10) default NULL, `shipping` char(1) default NULL, `payment` tinytext, `international` char(1) default NULL, `ends` varchar(14) default NULL, `current_bid` double(16,4) default NULL, `closed` char(2) default NULL, `photo_uploaded` char(1) default NULL, `quantity` int(11) default NULL, `suspended` int(1) default '0', `private` enum('y','n') NOT NULL default 'n', `relist` int(11) NOT NULL default '0', `relisted` int(11) NOT NULL default '0', `num_bids` int(11) NOT NULL default '0', `sold` enum('y','n','s') NOT NULL default 'n', `shipping_terms` tinytext NOT NULL, `bn_only` enum('y','n') NOT NULL default 'n', `adultonly` enum('y','n') NOT NULL default 'n', PRIMARY KEY (`id`), KEY `id` (`id`)) TYPE=MyISAM ;TABLE `checkout_order` ( `auction` varchar(6) NOT NULL default '', `user` int(32) NOT NULL default '0', `firstname` varchar(40) NOT NULL default '', `lastname` varchar(40) NOT NULL default '', `address` varchar(40) NOT NULL default '', `city` varchar(40) NOT NULL default '', `state` varchar(40) NOT NULL default '', `zip` varchar(40) NOT NULL default '', `country` varchar(40) NOT NULL default '', `phone` varchar(40) NOT NULL default '', `email` varchar(40) NOT NULL default '', `shipping_firstname` varchar(40) NOT NULL default '', `shipping_lastname` varchar(40) NOT NULL default '', `shipping_address` varchar(40) NOT NULL default '', `shipping_city` varchar(40) NOT NULL default '', `shipping_state` varchar(40) NOT NULL default '', `shipping_zip` varchar(40) NOT NULL default '', `shipping_country` varchar(40) NOT NULL default '', `amount` varchar(10) NOT NULL default '', `credits` varchar(10) NOT NULL default '', `ipaddr` varchar(15) NOT NULL default '', `processed` char(1) NOT NULL default '0', PRIMARY KEY (`auction`)) TYPE=MyISAM;The query I have been using is SELECT a.auction, a.winner, b.id, b.title, b.current_bid, c.auctionFROM winners a, auctions b, checkout_order cWHERE a.auction = b.idAND (b.closed =1OR b.closed = -1)AND b.suspended =0AND a.winner =17609AND a.auction != c.auctionLIMIT 0 , 30----in the auctions table I have the following records:id | title | current_bid1000 | something | 1.001001 | something | 1.001002 | something | 1.001003 | something | 1.00in the winners I have the following records:auction | winner| bid 1000 | 17609 | 1.001001 | 17609 | 1.001002 | 17609 | 1.001003 | 17610 | 1.00in the checkout_orders I have the following records:auction | user1002 | 176091003 | 17610so I would expect to see only the records 1000, 1001. However I get 1000,1001,1000,1000 Quote Link to comment https://forums.phpfreaks.com/topic/9901-find-unpaid-items-logic/#findComment-37004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.