hi all im a new bie. want to know that can we get the minimum value of same record. For example i have a row with a jewellery name "Celtic Ring" and it has different prices of e.g 10karat 18Karat and 24karat id = 1 name = celtic ring price10k = 10 price18k = 15 price24k = 19 price30k = 0 price40k = 0 how can i get the lowest price from this field and also it shouldn be zero? is it possible only with mysql without any php code
You want the minimal value per column that would be 5 results per product, or would you like the minimum price for the product, that would be one value ?
It would take a stored procedure to be able to return the lowest column of a single row. Databases aren't designed handle data storage and retrieval like this in a decent manner. If you want to do something like this the easiest way is to use 2 tables. table_1: id name table_prices: price_id item_id description price You can then add as many price / description combinations to a single item as you want and search, and retrieval becomes very fast and easy.