我正在执行以下查询(测试表):
select * from users order by id;
{"id":1,"firstname":"David","lastname":"Morrison","age":25,"income":100000}
{"id":2,"firstname":"John","lastname":"Anderson","age":35,"income":100000}
{"id":3,"firstname":"John","lastname":"Morgan","age":38,"income":null}
{"id":4,"firstname":"Peter","lastname":"Smith","age":38,"income":80000}
{"id":5,"firstname":"Dana","lastname":"Scully","age":47,"income":400000}
现在我想添加一个名为 modify_time($u) 的新列。所以我试过了
select *, modification_time($u) as mt from users $u order by id;
它因语法错误而失败,所以我尝试过
select $u.*, modification_time($u) as mt from users $u order by id;
它也因语法错误而失败
仅供参考,以下查询正在运行
select modification_time($u) as mt from users $u order by id;
想法是获得与此查询相同的结果,但不需要指定所有字段
select id , firstname, lastname, age, income, modification_time($u) as mt from users $u order by id;
{"id":1,"firstname":"David","lastname":"Morrison","age":25,"income":100000,"mt":"2021-06-18T08:39:08.326Z"}
{"id":2,"firstname":"John","lastname":"Anderson","age":35,"income":100000,"mt":"2021-06-18T08:39:08.332Z"}
{"id":3,"firstname":"John","lastname":"Morgan","age":38,"income":null,"mt":"2021-06-18T08:39:08.336Z"}
{"id":4,"firstname":"Peter","lastname":"Smith","age":38,"income":80000,"mt":"2021-06-18T08:39:08.338Z"}
{"id":5,"firstname":"Dana","lastname":"Scully","age":47,"income":400000,"mt":"2021-06-18T08:39:08.340Z"}
有人能帮我吗 ?