【问题标题】:convert into doctrine转化为教义
【发布时间】:2012-07-21 15:25:48
【问题描述】:
SELECT id, forename, surname, created 
FROM name n 
WHERE created = (SELECT MAX(created) 
                          FROM name 
                          GROUP BY id 
                          HAVING id = n.id);

schema.yml:

    id:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: true
      autoincrement: true
  lcreated:
      type: timestamp(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  forname/surname:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: false
      notnull: true
      autoincrement: false

我确实有一个额外的名字和姓氏的表格!

我怎样才能把它转换成学说 1.2?

【问题讨论】:

  • 你有 schema.yml 文件吗?你也应该展示它
  • 我用 schema.yml 更新了我的帖子

标签: mysql doctrine doctrine-1.2


【解决方案1】:

试试这个:

$query = Doctrine_Query::create()
  ->from('Name m')
  ->where('m.created = (SELECT MAX(gn.created) 
                          FROM Name gn
                          GROUP BY gn.id 
                          HAVING m.id = gn.id)');

Link to the documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-31
    • 1970-01-01
    • 2011-09-14
    • 2018-11-27
    • 1970-01-01
    相关资源
    最近更新 更多