- Messages
- 180
- Reaction score
- 0
- Points
- 26
,eto nlang po ... paano ko ba iseseperate yung column CNT sa code ko .. naka distinct kasi siya sa code ko, dapat di po siya kasama sa DISTINCT..
NOTE: na grup by ko na yung 3 columns tapos di ko sinama si column CNT pero mali yung RESULT..
idea po pls/ I mean different ways para magawa ko ito thanks.....
NOTE: na grup by ko na yung 3 columns tapos di ko sinama si column CNT pero mali yung RESULT..
idea po pls/ I mean different ways para magawa ko ito thanks.....
Code:
SELECT DISTINCT a.site_id,a.date_survey,(a.hour_from + " - " + a.hour_to) AS hour, b.volume as cnt
FROM survinfo_1dir a,survraw_1dir b
WHERE a.site_id = "SV01001LZ_AC" AND a.header_no=b.header_no
AND a.date_survey = "5/10/2006"
UNION ALL
SELECT DISTINCT c.site_id,c.date_survey,(c.hour_from + " - " + c.hour_to) AS hour, (isnull(d.volume_inc_post,0 ) + isnull(d.volume_dec_post,0)) as cnt
FROM survinfo_2dir c,survraw_2dir d
WHERE c.site_id= "SV01001LZ_AC" AND c.header_no=d.header_no
AND c.date_survey = "5/10/2006"