由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - A SQL problem
相关主题
[转载] a PLSQL questionRe: How to create a new database under SQL 7.0 from remote host?
SQL Server stupid questions[转载] 问一个MS SQL server的问题
Problem with this T-SQL statementHow to get SQL help in sqlplus?
每天只工作1小时的日子也挺没劲的。Can I create thousands table in one...
please help me solve a problem.[转载] question about SQL in Access
mysql challengeA SQL problem
Re: recursive sql?#在SQL里啥子意思
How to create a new database under SQL 7.0 from remote host?Help on Sql server huge table performance
相关话题的讨论汇总
话题: sql话题: min话题: max话题: problem话题: 18
进入Database版参与讨论
1 (共1页)
c********k
发帖数: 74
1
I have a problem in creating a SQL statement. Can anyone help me?
Suppose I have a table as below:
id min max
1 7 11
2 9 12
3 14 18
4 10 13
I would like to merge the min and max and finally get this:
min max
7 13
14 18
How can I create a SQL statement to get that? Is it possible? Thanks in
advance!
b******l
发帖数: 261
2
select min(min), min(max) from table
union
select max(min), max(max) from table

【在 c********k 的大作中提到】
: I have a problem in creating a SQL statement. Can anyone help me?
: Suppose I have a table as below:
: id min max
: 1 7 11
: 2 9 12
: 3 14 18
: 4 10 13
: I would like to merge the min and max and finally get this:
: min max
: 7 13

c********k
发帖数: 74
3
No. I didn't mean that. I mean
[7, 11] U [9, 12] U [14, 18] U [10, 13] = [7, 13] U [14, 18]
It is possible there are much more rows in that table, and then the
result will not be only two rows.

【在 b******l 的大作中提到】
: select min(min), min(max) from table
: union
: select max(min), max(max) from table

n********a
发帖数: 68
4

Explain your U operator. How does it work?????
Or give more examples, like another data set
where the final result is more than 2 rows.

【在 c********k 的大作中提到】
: No. I didn't mean that. I mean
: [7, 11] U [9, 12] U [14, 18] U [10, 13] = [7, 13] U [14, 18]
: It is possible there are much more rows in that table, and then the
: result will not be only two rows.

k******t
发帖数: 28
5
好象是数集里面的算符

Explain your U operator. How does it work?????
Or give more examples, like another data set
where the final result is more than 2 rows.

【在 n********a 的大作中提到】
:
: Explain your U operator. How does it work?????
: Or give more examples, like another data set
: where the final result is more than 2 rows.

c********k
发帖数: 74
6
Yes, set union operator

【在 k******t 的大作中提到】
: 好象是数集里面的算符
:
: Explain your U operator. How does it work?????
: Or give more examples, like another data set
: where the final result is more than 2 rows.

k******t
发帖数: 28
7
i guess you need not only sql query

【在 c********k 的大作中提到】
: Yes, set union operator
1 (共1页)
进入Database版参与讨论
相关主题
Help on Sql server huge table performanceplease help me solve a problem.
Database Encryptionmysql challenge
刚刚电面完,累死我了Re: recursive sql?
怎样找odd和even rowHow to create a new database under SQL 7.0 from remote host?
[转载] a PLSQL questionRe: How to create a new database under SQL 7.0 from remote host?
SQL Server stupid questions[转载] 问一个MS SQL server的问题
Problem with this T-SQL statementHow to get SQL help in sqlplus?
每天只工作1小时的日子也挺没劲的。Can I create thousands table in one...
相关话题的讨论汇总
话题: sql话题: min话题: max话题: problem话题: 18