由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - SQL combine two tables into one table and add a new column
相关主题
新手请教SQL 语法问题- alias 和 joinHow to Import a Datatable as fast as possible?
紧急求助, 关于SQL Server问个 sp_send_dbmail 的问题
请问个join的问题error of sql query in MS Access database (转载)
aks a simple SQL questionError of SQL query on IBM netezza SQL database from Aginity (转载)
最近写了不少SQL script,请大牛评价下属于什么水平咋样选一个表中在另一个表中不含有的记录
how to write this queryAccess 里面两个 column不一样的table 能combine 到一起吗?
SQL copy a table into a new table and add a new columnSQL question: update a field
help about SQL for ACCESSSQL combine two columns from two different tables no shared (转载)
相关话题的讨论汇总
话题: sql话题: column话题: select话题: group话题: add
进入Database版参与讨论
1 (共1页)
l******9
发帖数: 579
1
I need to add a column with an int value to the result from a subquery on
SQL.
It is Netezza SQL.
SELECT *
FROM
(
SELECT *
FROM table1
JOIN
table2
ON table1.id1 = table2.id1
GROUP BY table1.id2, table2.id3
) AS tt_a # here, I need to add a new column to tt, call it as top_id
and also assign an int value to it, such as 80
FROM
(
SELECT *
FROM table1
JOIN
table3
ON table1.id1 = table3.id1
GROUP BY table3.id2, table3.id3
) AS tt_b # here, I need to add a new column to tt, call it as top_id
and also assign an int value to it, such as 81
GROUP BY top_id, id2, id3
I em new to SQL.
Any help would be appreciated.
1 (共1页)
进入Database版参与讨论
相关主题
SQL combine two columns from two different tables no shared (转载)最近写了不少SQL script,请大牛评价下属于什么水平
怎样快速得到两个表的交集how to write this query
请教大虾问题哈,包子谢哈SQL copy a table into a new table and add a new column
mysql 问题 (转载)help about SQL for ACCESS
新手请教SQL 语法问题- alias 和 joinHow to Import a Datatable as fast as possible?
紧急求助, 关于SQL Server问个 sp_send_dbmail 的问题
请问个join的问题error of sql query in MS Access database (转载)
aks a simple SQL questionError of SQL query on IBM netezza SQL database from Aginity (转载)
相关话题的讨论汇总
话题: sql话题: column话题: select话题: group话题: add