Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

min function in SQLlite returns max value when used in inner join

in sqlite I have two tables named A350AttJustiMax and A350AttJustiMin.
Both have the same number of rows and columns. Columnname are identical.
In the image below you can se the columns Rfx of both tables on the right.
In the second column you see my attempt to get the min RFx out of these two tables, but I get the max RFx in return instead. If i change min() for max() I get what i want but i does not make sence to me…. What am I’m doing wrong?

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Redefine the data type of the columns as REAL instead of TEXT, or cast their values to numeric:

MIN(A350AttJustiMin.RFx + 0, A350AttJustiMax.RFx + 0) AS least_val 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading