0

如何在 SQL 查询中表达“c”列,如下所示:

SELECT a, b, 0 AS c
FROM mytable

SQLAlchemy 代码:

session.query(mytable.c.a, mytable.c.b, {???, c is a dynamic column})
4

1 回答 1

1
from sqlalchemy.sql.expression import literal_column
session.query(mytable.c.a, mytable.c.b, literal_column(u'0').label(u'c'))
于 2012-08-06T04:33:06.380 回答