I am trying to import a dataset using a custom SQL query. I would like to divide field B (all patients) by field A (patients with the specified comorbidity). However, every time the result seems to be 0.0, even if it should be closer to 1.0. The problem seems to persist every time the result is less than 1. Would anyone be able to help?
Hi @ekricha - Welcome to AWS community and thanks for posting the question. Can you please share the custom sql ( do not share PCI and PII info) and also what the input data types for field A and B, possibly you can use CAST to decimal precision. Please share the screenshot and sample input data and expected output so that we can help you in resolving the issue.
Regards - Sanjeeb
Thanks @ekricha , what is your source data base type ( is it MY SQL ?) please confirm.
Regards - Sanjeeb
The data is from Redshift
Thanks @ekricha - Can you try to cast the fields to decimal (10,2) in your CTE tables and then do the division.
If it is not working, i will spend sometime to create a Redshift cluster and try it from my side.
Please check and share your outcomes.
Regards - Sanjeeb
Hi @ekricha - Thank you and glad that issue is resolved. Have a wonderful day.
Regards - Sanjeeb