Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT D.Contents, D.CountOfUsed, CAST(CAST(D.CountOfUsed AS FLOAT) / P.Ratio AS NUMERIC(4, 3)) AS Ratio
- FROM (SELECT COUNT(*) AS Ratio
- FROM [dbo].[CheckInRecord]
- WHERE (dbo.CheckInRecord.Payment IS NOT NULL))
- AS P
- CROSS JOIN (SELECT STATUS.Contents, COUNT(STATUS.Contents) AS CountOfUsed
- FROM dbo.STATUS
- RIGHT OUTER JOIN dbo.CheckInRecord ON STATUS.STATUS = CheckInRecord.Payment
- WHERE (STATUS.Item = 'Payment')
- GROUP BY STATUS.Contents)
- AS D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement