sql语句中查询出的数据添加一列,并且添加默认值

查询出数据,并且要添加一列表中都不存在的数据,且这一列的值都是相等的

select app_id,app_secret from wx_ticket group by app_id;

查询出的数据是

app_id | expires_in
--------------------+------------
wxeec89cdf2d435d10 | 7200
wxeec89cdf2d435d10 | 7200
wx9b7bfb5f59df5009 | 7200
wx9b7bfb5f59df5009 | 7200
wx649ae9eecb72227d | 7200
wx649ae9eecb72227d | 7200

当使用select '20150429' date,app_id,app_secret from wx_ticket group by app_id;

date | app_id | expires_in
----------+--------------------+------------
20150429 | wxeec89cdf2d435d10 | 7200
20150429 | wxeec89cdf2d435d10 | 7200
20150429 | wx9b7bfb5f59df5009 | 7200
20150429 | wx9b7bfb5f59df5009 | 7200
20150429 | wx649ae9eecb72227d | 7200
20150429 | wx649ae9eecb72227d | 7200
20150429 | wxc01e853c2a2745c9 | 7200
20150429 | wx911d98d37516611c | 7200

原文地址:https://www.cnblogs.com/dashuai01/p/4464733.html