0

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. at the moment i have 100 users, so 100 data in my table. 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

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
GhostStack
  • 153
  • 1
  • 13
  • 3
    Normalize your table, one row per record. http://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad – chris85 Feb 22 '16 at 19:15
  • if i will do this like your way: would be the request time not to long? it can be thousand of rows – GhostStack Feb 22 '16 at 19:17
  • MySQL can handle millions of rows in no time... (given proper indexes) – Reeno Feb 22 '16 at 19:20
  • No. Databases are designed exactly for that purpose. If you put an index on the column(s) you often search for, e.g. on the date columns, then a query with even millions of records won't take longer than a blink of an eye. – PerlDuck Feb 22 '16 at 19:21

1 Answers1

0

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.

aynber
  • 22,380
  • 8
  • 50
  • 63