dqczgtem06898 2018-04-21 22:09
浏览 56
已采纳

PHP / SQL:防止重复选项值

So I am trying to create a query that shows the list of all the dates customers came in to order food. However, since there were multiple customers for a particular day and thats how the values have been stored in the table, whenever I turn the following query:-

SELECT DateOfEntry FROM KFC;

Although it works and I see all the details, I dont want the same date value to repeat. For example if Two customers A and B, came in on 11/11/17 to order food, I would get the result of the above mentioned query with two records of same date. I dont want the same dates to repeat. What do I do? I know DISTINCT works but the problem is, I am creating a php page where admins can check the list of all the users who came in on a particular day. So I am using the select and option methods of HTML to select a date which then shows the list of the users who made an entry that day. With this code, only one record is shown

  • 写回答

2条回答 默认 最新

  • dongling4288 2018-04-21 22:11
    关注

    Try:

    SELECT DISTINCT DateOfEntry FROM KFC;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题