Home > database >  min function in SQLlite returns max value when used in inner join
min function in SQLlite returns max value when used in inner join

Time:01-31

In SQLite I have two tables named A350AttJustiMax and A350AttJustiMin. Both have the same number of rows and columns. Column names 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 it does not make sense to me.... What am I'm doing wrong?

enter image description here

CodePudding user response:

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 
  •  Tags:  
  • Related