aql查询 [英] aql query
问题描述
我正在使用访问并获得了一个包含字段的表:
CatName,CatOrder和StoreID。
i需要获取所有CatName的列表并且知道我得到了多少结果
或者CatOrder字段中的最大值是什么。
可以只用一个查询来完成,或者我需要先做最大查询?
i''m using access and got a table with the fields:
CatName, CatOrder and StoreID.
i need to get the list of all the CatName and to know how many result i got
or what is the max value in the CatOrder field.
can it be done with only one query or i need to do the max query first?
推荐答案
" Sagi" < SA ** @ schieber.net>在消息中写道
news:42 ****** @ news.bezeqint.net ...
"Sagi" <sa**@schieber.net> wrote in message
news:42******@news.bezeqint.net...
我正在使用访问并获得了一个包含字段的表:
CatName,CatOrder和StoreID。
我需要获取所有CatName的列表,并知道我获得了多少结果或CatOrder字段中的最大值是什么。可以只使用一个查询来完成,还是我需要先进行最大查询?
i''m using access and got a table with the fields:
CatName, CatOrder and StoreID.
i need to get the list of all the CatName and to know how many result i
got or what is the max value in the CatOrder field.
can it be done with only one query or i need to do the max query first?
有点不清楚你想要什么,但是这个:
SELECT [tblOrders]。[CatName],Count([tblOrders]。[CatName])AS numCatName,
Max([tblOrders]。[CatOrder])AS maxCatOrder
FROM tblOrders
GROUP BY [tblOrders]。[CatName];
会给你:
>
表格中每个CatName一行
第1列将是CatName
第2列将是每个CatName出现在表格中的次数
第3列将是该CatName的CatOrder的最大值。
Mike
A little unclear what you want but this:
SELECT [tblOrders].[CatName], Count([tblOrders].[CatName]) AS numCatName,
Max([tblOrders].[CatOrder]) AS maxCatOrder
FROM tblOrders
GROUP BY [tblOrders].[CatName];
will give you:
one row for each CatName in the table
column 1 will be the CatName
Column 2 will be the number of times each CatName appears in the table
Column 3 will be the maximum value of CatOrder for that CatName.
Mike
抱歉,我知道,但这不是我需要的。我会再试一次。
i需要显示所有行并知道所有行的最大值(CatOrder)。
当我这样做时我只返回一行得到最大值的那个(CatOrder)。
i需要知道最大值(CatOrder)并将所有行也带回来。
我必须使用2个分开查询??
" Sagi" < SA ** @ schieber.net>在消息中写道
news:42 ****** @ news.bezeqint.net ...
sorry, this i know, but it''s not what i need. i will try again.
i need to show all the rows and to know the max(CatOrder) for all the rows.
when i do it i get only one row back, the one that got the max(CatOrder).
i need to know the max(CatOrder) and to get all the rows back too.
do i must use 2 seperated queries??
"Sagi" <sa**@schieber.net> wrote in message
news:42******@news.bezeqint.net...
我正在使用访问并获得了一个包含字段的表:
CatName,CatOrder和StoreID。
我需要获取所有CatName的列表,并知道我获得了多少结果或CatOrder字段中的最大值是什么。 />可以只用一个查询来完成,还是我需要先进行最大查询?
i''m using access and got a table with the fields:
CatName, CatOrder and StoreID.
i need to get the list of all the CatName and to know how many result i
got or what is the max value in the CatOrder field.
can it be done with only one query or i need to do the max query first?
对不起,我知道,但它是'不是我需要的。我会再试一次。
i需要显示所有行并知道所有行的最大值(CatOrder)。
当我这样做时我只返回一行得到最大值的那个(CatOrder)。
i需要知道最大值(CatOrder)并将所有行也带回来。
我必须使用2个分开查询??
" Mike MacSween" < MI *************************** @ btinternet.com>写在
消息新闻:42 *********************** @ news.aaisp.net.uk ..。
sorry, this i know, but it''s not what i need. i will try again.
i need to show all the rows and to know the max(CatOrder) for all the rows.
when i do it i get only one row back, the one that got the max(CatOrder).
i need to know the max(CatOrder) and to get all the rows back too.
do i must use 2 seperated queries??
"Mike MacSween" <mi***************************@btinternet.com> wrote in
message news:42***********************@news.aaisp.net.uk.. .
" Sagi" < SA ** @ schieber.net>在消息中写道
新闻:42 ****** @ news.bezeqint.net ...
"Sagi" <sa**@schieber.net> wrote in message
news:42******@news.bezeqint.net...
我正在使用访问权限并得到一个包含字段的表格:
CatName,CatOrder和StoreID。
我需要获取所有CatName的列表,并知道我有多少结果或CatOrder字段中的最大值是什么。
它可以吗只需要一个查询,或者我需要先进行最大查询吗?
i''m using access and got a table with the fields:
CatName, CatOrder and StoreID.
i need to get the list of all the CatName and to know how many result i
got or what is the max value in the CatOrder field.
can it be done with only one query or i need to do the max query first?
有点不清楚你想要什么但是这个:
SELECT [tblOrders]。 [CatName],Count([tblOrders]。[CatName])AS numCatName,
Max([tblOrders]。[CatOrder])AS maxCatOrder
FROM tblOrders
GROUP BY [tblOrders]。[ CatName];
会给你:
表中每个CatName的一行
第1列将是CatName
第2列将是每个CatName出现在表格中的次数
第3列将是该CatName的CatOrder的最大值。
Mike
A little unclear what you want but this:
SELECT [tblOrders].[CatName], Count([tblOrders].[CatName]) AS numCatName,
Max([tblOrders].[CatOrder]) AS maxCatOrder
FROM tblOrders
GROUP BY [tblOrders].[CatName];
will give you:
one row for each CatName in the table
column 1 will be the CatName
Column 2 will be the number of times each CatName appears in the table
Column 3 will be the maximum value of CatOrder for that CatName.
Mike
>
这篇关于aql查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!