DISTINCT结果来自db使用sql查询

时间:2014-02-13 09:32:30

标签: php mysql zend-framework2

我在Zend Framework 2中工作。 如何从此查询中仅获取 jobtitle 的唯一值?

$jobselect = $jobstable->select()
                        ->setIntegrityCheck(false)
                        ->from($jobsname, array("$jobsname.title as jobtitle", "$jobsname.company as company", "$storagename.storage_path as companylogo", "$jobsname.location as location"))
                        ->join($storagename, "$storagename.parent_id = $jobsname.job_id")    
                        ->where("$storagename.parent_type = ?", "job")
                        ->where("$storagename.type = ?", "thumb.icon")
                        ->where("$jobsname.user_id = ?", 244);

1 个答案:

答案 0 :(得分:0)

->where("$jobsname.user_id = ?", 244)
-group("jobtitle");