简体   繁体   中英

Unable to get 2 values using distinct

I have created a product slider that is working with banner id and category i want to call category but not the duplicates one i tried to do using distinct but it's not working out for me

here is what i used

<?php     
$cat_query = mysqli_query($connection, "SELECT DISTINCT category,bid FROM banners WHERE category != 'None'");
?>

but still i am getting duplicates records can anyone help me out as i want too get bid and category as well both

There is no way you can get Distinct Categories with bid. You should either use Distinct Categories alone or sort your data based on required bid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM