...
No Format |
---|
SELECT m.name, avg(m.medians) medians from ( SELECT x.name, x.val medians FROM A x, A y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2 )AS m group by m.name; |
...
Save SQL results in a csv file,
...
No Format |
---|
SELECT ...
FROM ...
INTO OUTFILE '/tmp/sqlresult.csv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n';
|