Skip to content

Instantly share code, notes, and snippets.

@staticor
Created February 17, 2016 03:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staticor/adffb1865684afa0fdc3 to your computer and use it in GitHub Desktop.
Save staticor/adffb1865684afa0fdc3 to your computer and use it in GitHub Desktop.
mysql retrieve data in Shell.
function run_Mysql()
{
mysql --default-character-set=utf8 \
-h 192.168.156.120 \
-u data -p'PIN239!@#$%^&8' \
-D optimus \
-e "
select platform, day
, SUM(bid) as bid , SUM(imp) as imp
, sum(click) as click
, sum(adv_cost) as cost
from report.rpt_effect_day
where day > ADDDATE(SYSDATE(), INTERVAL - 8 day) and platform = 'XiaoMi'
group by platform, day
order by day
" > output_mysql.data
}
run_Mysql;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment