I have a table (DBname) with 2 columns. column1 (datatype =dates) has the dates for the next 2 years. column2 (datatype = integer) some data i've assigned. How can I get SQL to select the data in column2 that corresponds with the current system date. i've tried the following without success it return a blank... I am using MySQL
SELECT column2 FROM DBname WHERE column1 = CURRENT_DATE
if i change it to
SELECT column2 FROM DBname WHERE column1 > CURRENT_DATE
it returns column2 rowid1
if i change it to
SELECT column2 FROM DBname WHERE column1 > CURRENT_DATE
it returns column2 rowid3
... really confused... is it possible the problem is in the database itself??
as for the data.. i imported an excel file with the dates in column1.. i wrote the first date in and formatted it then dragged down about 2 years to populate the rest.... as for the column2 data it is just numbers i have placed in... an example would be
column1 1-dec-12, 2-dec-12, 3-dec-12, 4-dec-12
column2 2, 4, 18, 19
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…