简体   繁体   English

MySQL选择ID,其中日期是当前日期

[英]mysql select ID where date is current date

i have this table structure: 我有这个表结构:

Rows 行数

ID |  Counter  |  Dates

Values 价值观

1  |  100;300;44 |  01.01.2016;02.11.2016;03.03.2017

each ID is connected to an separated user. 每个ID都连接到一个单独的用户。 at the moment i have 100 users, so 100 data in my table. 目前我有100个用户,因此表中有100个数据。 now i need an sql command, which show me the the ID from the user, which have a date in the Dates-Row, which is the same like the current date 现在我需要一个sql命令,向我显示用户的ID,该ID在Dates-Row中有一个日期,与当前日期相同

This is untested, but it should be: 这未经测试,但应该是:

SELECT * FROM `table` WHERE Dates LIKE CONCAT('%',DATE_FORMAT(CURDATE(),'%m.%d.%Y'),'%');

This will select the current date CURDATE() , put it in the format you use in your table, then stick wildcards on each end so it will look inside of the string within your Dates column. 这将选择当前日期CURDATE() ,将其以您在表中使用的格式放置,然后在每个末端粘贴通配符,以便它将在Dates列中的字符串内部显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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