由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - sql high hand please help.
相关主题
any informix high hand here? sql need help here.(MSSQL) How to handle parallel processing --Copying objects to the same dbs from different source
一个SQL写法性能的请教MSSQL Power Function
给偶一个干活的机会,何如? 申请作Database板副random error for CAST( MONEY AS VARCHAR)
Oracle 问 题 请 诸 位 大 侠 指 教, 急 急 急!!!吃了包子, 幹活了!
急问一个关于T-SQL的问题,谢谢问个mssql 问题
SQL combine two columns from two different tables no shared (转载)MSSQL how to create 10 tables with the same structure but different names
SQL questionMSSQL 一个view的性能调试问题
请教传数据问题How to list all the tables in oracle?
相关话题的讨论汇总
话题: tables话题: avg话题: price话题: three话题: sql
进入Database版参与讨论
1 (共1页)
w******n
发帖数: 15
1
say i have three tables, motel, resorts, bed-breakfirst,
and all three tables have a column called price.
and i want to calculate avg, max, and min price
from all three tables. how do i do that?
i know select avg(price) from table-name
but it only gives me avg price from only one table,
how do i get all three tables' avg???
b****e
发帖数: 1275
2
select avg(price) from
(select price from motel union
select price from resorts union
select price from bed_breakfast);

【在 w******n 的大作中提到】
: say i have three tables, motel, resorts, bed-breakfirst,
: and all three tables have a column called price.
: and i want to calculate avg, max, and min price
: from all three tables. how do i do that?
: i know select avg(price) from table-name
: but it only gives me avg price from only one table,
: how do i get all three tables' avg???

w******n
发帖数: 15
3
informix sql says u can't use union inside a sub query.
any other ideas???

【在 b****e 的大作中提到】
: select avg(price) from
: (select price from motel union
: select price from resorts union
: select price from bed_breakfast);

b****e
发帖数: 1275
4
sorry don't know informix well.. dump informix :)
who still uses it anyway :)

【在 w******n 的大作中提到】
: informix sql says u can't use union inside a sub query.
: any other ideas???

f*****c
发帖数: 22
5
Use create view that is the union of several tables, and then issue query against
the view?
Don't know whether it works or not in informix. It is ok in MSSql server.
1 (共1页)
进入Database版参与讨论
相关主题
How to list all the tables in oracle?急问一个关于T-SQL的问题,谢谢
a complex sql query, high hand help!!!SQL combine two columns from two different tables no shared (转载)
Urgent help!!!SQL question
help about SQL for ACCESS请教传数据问题
any informix high hand here? sql need help here.(MSSQL) How to handle parallel processing --Copying objects to the same dbs from different source
一个SQL写法性能的请教MSSQL Power Function
给偶一个干活的机会,何如? 申请作Database板副random error for CAST( MONEY AS VARCHAR)
Oracle 问 题 请 诸 位 大 侠 指 教, 急 急 急!!!吃了包子, 幹活了!
相关话题的讨论汇总
话题: tables话题: avg话题: price话题: three话题: sql