perficut Posted November 4, 2009 Share Posted November 4, 2009 I'd like to get all the records in my database that have the same Solicitation# which is also the propertyid in another database (hense the reference), and out of those records find out if the current user has submitted a bid. If so, i'd like to assign those bids to variables to be called on later in the page. The dbase has the following fields Solicitation ContractorID bid1 bid2 bid3 $sql2="SELECT * FROM ProcurementBids WHERE Solicitation='$propertyid' AND ContractorID='$contractor_id'" or die(mysql_error()); ; $result=mysql_query($sql2); $existingbid = ($result); If the user has entered several bids for the same solicitation, How do I get to the record that has the lowest bid1 value? I hope this makes sense. Link to comment https://forums.phpfreaks.com/topic/180316-getting-confusedmysql-query-with-multiple-requirements/ Share on other sites More sharing options...
ram4nd Posted November 4, 2009 Share Posted November 4, 2009 use ORDER BY and LIMIT, there is also function called MIN what i haven't ever used so i don't know how it works Link to comment https://forums.phpfreaks.com/topic/180316-getting-confusedmysql-query-with-multiple-requirements/#findComment-951201 Share on other sites More sharing options...
perficut Posted November 5, 2009 Author Share Posted November 5, 2009 thanks but I think my SELECT query gets what the same data. I just cant figure out how to now search those records for the one that has the lowest value in bid1, unless I can use the MIN in the SELECT query along with the other parameters. Didnt try that, but will. I thought there might be a for while loop to get that record. Link to comment https://forums.phpfreaks.com/topic/180316-getting-confusedmysql-query-with-multiple-requirements/#findComment-951407 Share on other sites More sharing options...
xtopolis Posted November 5, 2009 Share Posted November 5, 2009 This question looks like this thread: http://www.phpfreaks.com/forums/index.php/topic,275518.0.html but using MIN instead of MAX Link to comment https://forums.phpfreaks.com/topic/180316-getting-confusedmysql-query-with-multiple-requirements/#findComment-951499 Share on other sites More sharing options...
fenway Posted November 14, 2009 Share Posted November 14, 2009 This is going to be more complicated since you don't have a normalized database design. Link to comment https://forums.phpfreaks.com/topic/180316-getting-confusedmysql-query-with-multiple-requirements/#findComment-957455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.