4
我試圖連接表,但結果分成兩列(列relative_duration的值)始終爲0查詢如下:如何劃分兩列?
SELECT t1.[user_1]
,t1.[user_2]
,t1.[total_duration]
,(t1.total_duration/t2.[total_events_duration]) AS relative_duration
FROM [CDRs].[dbo].[aggregate_monthly_events] AS t1 INNER JOIN [CDRs].[dbo].[user_events_monthly_stats] AS t2 ON t1.[user_1] = t2.[user_1]
有誰知道什麼可能是錯在上面的查詢,以及如何修正它以便將表t1中的列total_duration與表t2中的total_events_duration列分開?
順便說一句我試圖與減法來代替除法(「/」與「 - 」),並在這種情況下,柱relative_duration不是0