I want to add a column to my query results that repeats the current timestamp for all records returned. This would effectively be a column that tells you when the query was executed.
Tried using With, Union, and Join...but it doesn't seem like there's a way to "print" data into sql results that are not already contained in the database.
Select * from myTable
Union
select current_timestamp
print (select current_timestamp)
The results would be all of the contents of the table with an extra column that has the current_timestamp for all records returned.
if you want the current_timestamp on each row resulting form select You should only add the col
Select *, current_timestamp
from myTable
try:
Select * from myTable
Union
select current_timestamp as timeStamp
您需要将TIMESTAMP放在select子句中,如下所示-
Select *,current_timestamp from myTable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.