In MS Access, I want to insert a new column into the returned result of a select query. The new column has the same value for every row. For example, my select returns columns A, B and I want C to be the new column created by the select query:
A B C ---------- a1 b1 c a2 b2 c a3 b3 c
The basic syntax for adding a new column is as follows: ALTER TABLE table_name ADD column_name data_type constraints; The SQL ALTER TABLE add column statement we have written above takes four arguments. First, we specify the name of our table.
Manually add it when you build the query: SELECT 'Site1' AS SiteName, t1. column, t1. column2 FROM t1 UNION ALL SELECT 'Site2' AS SiteName, t2.
select A, B, 'c' as C from MyTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With