SELECT DISTINCT YEAR原则 [英] SELECT DISTINCT YEAR Doctrine
本文介绍了SELECT DISTINCT YEAR原则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用doctrine从mysql数据库中选择不同的年份:
I want to select distinct year from mysql database using doctrine:
使用mysql很容易做到这一点
it is easy to do this using mysql
SELECT DISTINCT DATE_FORMAT( year , '%Y') as dates FROM Inscription
我没有在doctrine文档中找到如何做,任何人都可以帮助?
i don't find how to do this in doctrine documentation, anyone can help?
推荐答案
如果你使用Postgresql,您将收到:
If you use Postgresql, you will receive:
select('SUBSTRING(offer.date_closed, 0, 5)')
函数substr(没有时区整数整数的时间戳)不
exists
function substr(timestamp without time zone integer integer) does not exist
使用:
select('SUBSTRING(CONCAT(offer.date_closed, \'\'), 0, 5)')
这篇关于SELECT DISTINCT YEAR原则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文