分享
 
 
 

在sql查询中使用了(select count(*) form table where xxx=x)as xx子查询,能根据xx列的植使结果排序吗

王朝知道·作者佚名  2009-04-09
窄屏简体版  字體: |||超大  
 
分類: 電腦/網絡 >> 程序設計 >> 其他編程語言
 
問題描述:

SELECT DISTINCT [company], [year], [xueli], [zy], (select count(*) from gs where company=x.company and year=x.year and xueli=x.xueli and zy=x.zy) AS countXFROM gs AS xGROUP BY [year], [company], [xueli], [zy]ORDER BY [year], [company],countx;-------------------想根据countx;排序但是出错谢谢高手解决

參考答案:

一、as作连词的用法

1. as...as的用法

as...as意为"和……一样",表示同级的比较。使用时要注意第一个as为副词,第二个as为连词。其基本结构为:as+ adj./ adv. +as。例如:

(1)This film is as interesting as that one.这部电影和那部电影一样有趣。

(2)Your pen writes as smoothly as mine.你的钢笔书写起来和我的一样流畅。

其否定式为not as/so +adj./ adv. +as。例如:

This dictionary is not as/so useful as you think.这本字典不如你想象的那样有用。

若有修饰成分,如twice, three times, half, a quarter等,则须置于第一个as之前。例如:

Your bag is twice as expensive as mine.你的袋子比我的贵一倍。

几个关于as...as的常见句型:

(1)as...as possible

Please answer my question as soon as possible.请尽快回答我的问题。

(2)as...as usual/before

She looks as pretty as before.她看起来和以前一样漂亮。

(3)as long as... (引导条件状语从句)

It took us as long as three years to carry out the plan.我们花了长达三年的时间才完成这项计划。

(4)as far as

He walked as far as the railway station yesterday evening.昨天傍晚,他一直散步到火车站。

(5)as well as

She cooks as well as her mother does.她烧菜烧得跟她母亲一样好。

一些带有as...as结构的常见短语归纳:

as busy as a bee像蜜蜂一样忙碌

as easy as ABC像ABC一样容易

as deep as a well像井一样深

as light as a feather像羽毛一样轻

as soft as butter像黄油一样软

as rich as a Jew像犹太人一样富裕

2. as用作连词引导时间状语从句

as与when,while都是引导时间状语从句的从属连词,含义都是"当……的时候"。但它们有区别:用when时,从句的动作可以与主句的动作同时发生,也可以先于主句的动作发生;用while时,从句的动作为一过程,主句动作与从句动作同时进行或在从句动作过程中发生;用as时,主句和从句的动作同时发生,具有延续的含义。例如:

(1)It was snowing when he arrived at the construction site.他到达工地时,天正在下雪。

(2)He was watching TV while his mother was cooking.他母亲做饭时他在看电视。

(3) You will grow wiser as you grow older.你会随着年龄的增长而越来越聪明。

3. as用作连词引导原因状语从句

as,because,since都可以表示因果关系,连接原因状语从句,含义是"因为,由于",但它们有区别:because表示的语气最强;as一般放在句首,语气较弱,较口语化;since常常用在书面语中,表示多为对方已知的、或稍加分析便可得知的原因,有时可译作"既然"。例如:

(1) He will succeed because he is in earnest.他一定会成功,因为他很认真。

(2) Since you are so sure of it he”ll believe you.既然你对此如此有把握,他会相信你的。

(3) As rain has fallen, the air is cooler.因为下过雨,空气比较清爽。

4. as作连词引导让步状语从句

as与although (或though),however (或no matter how)等都可以引导让步状语从句,含义是"虽然,尽管",但它们有区别:although语气稍正式些,可放在句首,也可放在句中,主句中不能再用but,但可以用yet;as所表示的语气较强,引导的让步状语从句用倒装语序;however引导让步状语从句时,它的后面可跟形容词或副词,也要用倒装语序。例如:

(1) Although he is quite old, he still jogs every day.他虽然年纪相当大,仍然每天慢跑。

(2) Strange as it may seem, nobody was injured in the accident.这次意外虽然显得令人不可思议,却没有人受伤。

(3) However hard he may try, he will not attain his goal.无论他怎样努力也达不到目标。

二、as作关系代词的用法

关系代词as引导定语从句时,既可以单独使用,也可以与其他词连用,其用法要比that和which更为复杂。

1. as引导定语从句与其他词连用

①用于the same...as结构中

This is the same book as I read last week.这本书和我上周读的那本是一样的。

②用于such...as结构中

I don”t like such books as he recommends.我不喜欢他推荐的那些书。

③用于"so +adj. + a/an + n. (单数) + as "结构中

I am not so strong a man as I was.我已经没有从前那么强壮了。

2. as单独引导定语从句

as单独引导定语从句时,先行词可以是一个词,也可以是一个句子或短语。例如:

(1) She is late, as is often the case.她迟到了,这是经常的事。(先行词是整个主句)

(2) To shut your eyes to facts, as many of you do, is foolish.对事实视而不见--你们好多人都是如此的愚蠢。(先行词是不定式短语)

三、as作介词的用法

as作介词,意思是"作为","以……身份"。例如:

He came to China as a tourist five years ago.他五年前以游客的身份来过中国。

四、as作副词的用法

to the same degree or amount; equally "相同地","同样地"。例如:

They don”t have as many airplanes.他们没有同样多的飞机。

回答者:sikosuru - 试用期 一级 8-19 21:54

as的用法很多

As的用法小结

as可以作连词、介词及关系代词和副词。现将其用法小结如下:

(一)、 as作连词的用法:

1.作“在-------期间,当----的时候”引导时间状语从句.注意与when、 while的用法区别。

①下列情形时,只用as, 而不用when或while。

1)用于表示同一个人的两种动作交替进行,指一边----一边. 如:

The girl sings as she goes to school.

He looked behind occasionally as he went forward in the forest.

2)表示两个同步发生的动作或行为,意思是随着-----的发展.如:

As time went on / by, she became more and more beautiful .

As children get older, they become more and more interested in everything.

3)表示两个短暂行为或事情几乎同时发生.如:I watched her as she read the book.

I thought of it just as you opened your mouth.

Just as the flying worm hit her face, she gave a loud cry.

4)接在名词后面表示某一个年龄段时.如:

As a young man, he was active in sports.

②when作"当……的时候"解,可以指较短的(一点)时间,也可指一段时间。如:When I was at college, I could speak several foreign languages. When the clock struck twelve, I had slept for 2hours.

③ while常表示一段较长的时间或一个过程,强调主句谓语动词与从句谓语动词同时发生。如:Work while you work. Play while you play.

2. As =Since 作"既然"、"由于"解,引导原因状语从句,常用来表示已为人们所知或显而易见的原因或理由。如: As he’s been ill for ages, I will help him.

As / Since you’re not feeling well, you may stay at home.

As he wasn’t ready , we went without him.

3. As =in the way that作"像"、"按照……的方式"解,引导方式状语从句。如:

Do as I told you.

Remember, you must do everything as I do.

4. 用于as--- as或not / so/ as ---- as中,前一个as是副词,后一个as是连词,引导比较状语从句。如:They helped the old as much as possible.

I don’t speak English so/ as well as she does.

5. 表示虽然,尽管 等,引导让步状语从句,常用倒装语序,模式为:

adj. /adv. / n.+as +主语+谓语+主句。如: Young as he is, he knows much.

Tired as they were, they walked on.

6. 表示也------一样。 She is a doctor, as was her husband.

(二)、 as作关系代词,引导定语从句,表示正如,这一点.如:

He is very careful, as we all know.

As is well-known, Taiwan belongs to China.

另外,当先行词被the same, such等词修饰时,常用as来引导定语从句。如:

Such a clever girl as she can learn anything quickly.

I was reading the same book as he bought yesterday.

(三)、as作介词的用法.

1.表示好像。如:He dressed as a policeman.

2. 表示作为当作。如:I found a job as a guide.

3. 当某人是某身份时。如:As a child , she was sent to abroad.

4. as引导的介词短语大多用作状语,as译为"作为";少数情况可引起宾语补足语。如:

As a Party member, I’ll take the lead in everything. (状语)

She works as a model. (状语)

She has me as one of her best friends.(引起宾语补足语)

(四)、作副词的用法 1 表示与------等同。如:This dress is twice as expensive as that one. 2 像,如等。如:As before, he remained unmoved.

小贴士:① 若网友所发内容与教科书相悖,请以教科书为准;② 若网友所发内容与科学常识、官方权威机构相悖,请以后者为准;③ 若网友所发内容不正确或者违背公序良俗,右下举报/纠错。
 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有