- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
(require 'clsql)
(clsql:file-enable-sql-reader-syntax)
(clsql:connect
'("localhost" "database" "user" "password")
:database-type :mysql)
(defun how-many-goods-do-you-have (year month)
(declare
(type (integer 2000 2011) year)
(type (integer 1 12) month))
(clsql:select [item_id] [sale_date]
:from "table"
:where [or
[is [null [sale_date]]]
[< [sale_date]
(clsql:sql 'str_to_date\(
(format
nil
"~a-~2,'0d-00"
year month)
'|, '%Y-%m-%d')|
)]]))