Hi Patrick,
Am I right that fractional exposures will always have one as the numerator?
I.e., you might record an exposure as "1.5" seconds, but never as "3/2"
seconds? If so, then that might simplify things.
The example below creates a column named "canon" to hold the canonical
exposure string value for sorting and grouping.
It assumes any non-decimal fractions will begin with the string "1/"
CREATE TABLE expo (str TEXT, canon TEXT);
INSERT INTO expo(str) VALUES ('1/30'), ('1/500'), ('1/6000'), ('.5'), ('6');
UPDATE expo
SET canon =
CASE WHEN substr(str,1,2) == '1/'
THEN printf( '%014.8f', (1.0 / substr(str,3)) )
ELSE
printf( '%014.8f', str)
END;
.mode tabs
SELECT * FROM expo;
1/30 00000.03333333
1/500 00000.00200000
1/6000 00000.00016667
.5 00000.50000000
6 00006.00000000
Note that I used a newer sqlite version which includes the handy printf()
function.
Donald
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users