2012-05-31 88 views
0

我在widget_event_data表中有played_dt列。这种格式2009-06-16 21点38分07秒SQL查询 - 无法比较字段值?

我想行其played_dt plyed_dt保存日期包含2009-06-16

有什么办法去做这个。我怎么能写这个SQL查询?

将是帮助感激..

回答

2
WHERE DATE(played_dt) = '2009-06-16' 
2
select * from your_table 
where played_dt like '2009-06-16%' 
+0

有什么用?% 你能告诉我吗? – Vicky

+0

%是字符串通配符匹配器 –

+0

'%'是通配符,意味着日期字符串只能匹配日期而不匹配其他日期。 –

0
select * from table where played_dt = '2009-06-16' 

作品在oracle中。

0

使用DATE()函数。试试这个:

select * 
FROM widget_event_data 
where DATE(played_dt) = DATE('2009-06-16') 
0

select * from tableName
where played_dt = str_to_date('2009-06-16', '%Y-%m-%d')

看到更多mysql str_to_date