Skip to content

Instantly share code, notes, and snippets.

@mtellezj
Last active March 2, 2020 20:36
Show Gist options
  • Save mtellezj/cf53b021026572a851fb5838cdf86726 to your computer and use it in GitHub Desktop.
Save mtellezj/cf53b021026572a851fb5838cdf86726 to your computer and use it in GitHub Desktop.
* MySql database
:PROPERTIES:
:header-args:sql: :engine mysql
:header-args:sql+: :cmdline "my_db -u john_doe -h 127.0.0.1"
:header-args:sql+: :var start_date="2019-02-27"
:header-args:sql+: :var end_date="2020-02-29"
:END:
** Get all clients
Press C-c C-c inside next block to query the database.
#+begin_src sql :results value raw org
SELECT *
FROM clients
WHERE last_modified BETWEEN "$start_date" AND "$end_date";
#+end_src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment