English 中文(简体)
页: 1 申请表
原标题:SQL Append table queries
  • 时间:2010-07-26 02:44:16
  •  标签:
  • sql

I have two tables, say table1 with two rows of data say row11 and row12 and table2 with 3 rows of data sat row21, row22, row23

任何人都能够向我提供卡片,以制造一个返回的麻烦。

row11
row12
row21
row22
row23

注:我无意在数据回馈时设立一个新的表格。

问题回答

使用<代码>UNION ALL,根据实例数据:

SELECT * FROM TABLE1
UNION ALL
SELECT * FROM TABLE2

<代码>UN中删除了重复之处——如果两个表的数值为“第1行”,则查询将退回一个行,而不是两个。 由于<代码>UNION ALL不去掉重复,因此,<>UNION <>UNION 低于。 了解你的数据并适当使用。

select * from table1 union select * from table2

为什么不使用联合国的想法?

SELECT Col1,Col2,Col3 FROM TABLE1

意 见

SELECT Col1,Col2,Col3 FROM TABLE2

两个表格的栏目是否相同?

在<>MS Access上,你可以用实现同一目标。 INSERT INTO 问题:

INSERT INTO TABLE1 SELECT * FROM TABLE2;




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...