-01-02 09:17:00' ),(10,34, '2019-01-02 09:18:00');select date(l.date_time) as `date`, (select count(distinct(l.visitor_id)) from `logs` l join info i on (i.id_no = l.visitor_id) where i.`name` = 'CUSTOMER' and l.visitor_id=i.id_no) as total_customer,
我希望我的Gorm查询返回正确的version_count。我的Gorm查询返回0 version_count,而我的MySQL查询返回version_count。我为我的Gorm查询提供了以下内容:
subQuery := models.DB.Select("services.id as services_id, COUNT(versions.service_id) as version_count").Group("services.id").
VARCHAR(50))+'_'+SUBSTRING(NO_ORDRE_CUMMUL, 0, CHARINDEX('_', NO_ORDRE_CUMMUL + '_')) as NOLVLEFTOUTER JOIN LETTRE_VOIT_FINAL
ON charindex('_'+cast(ORDRE.NO_ORDRE as varchar(255))+'_', '_'+LETTRE_VOIT_FINAL.N