运行或打开查询时出现问题 [英] Problem in running or open the query

查看:91
本文介绍了运行或打开查询时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..


这是我第一次使用微软访问创建报告。

实际上我需要根据数据库调用构建一个报告表1.

我只使用2列数据库来输入我的报告。


1)状态

2)状态


对于状态,我需要根据状态值将其分开;

例如:1)准备好

2)未准备好


我创建了2个查询,一个用于准备,一个用于未准备好。

我将这个2查询合并到一个名为StateStatus的查询中以构建报告。


当我运行或打开以查看StateStatus查询时,会出现错误消息。我只能通过设计视图查看它。


错误:

查询无法完成查询结果的大小大于数据库的最大大小(2GB),或者磁盘上没有足够的临时存储空间来存储查询结果。


这是我创建que的步骤ry报告错了?

如何解决使查询可以运行或打开。


谢谢。

解决方案
您好。当您尝试将它们相互连接时,听起来您不小心将两个查询相乘。这被称为行的笛卡尔积,当您包含表但忽略将它们连接到相关的公共字段时会发生这种情况。我不确定你想要用你提到的两个字段做什么 - 状态和状态 - 但最明显的是按有关值分组并计算每个状态的行数。


您不需要两个查询来执行此操作。最简单的方法是使用Access查询编辑器,将主表添加到查询中,使用View,Totals选择分组和总计,添加状态和状态字段,然后添加状态字段的副本,为其指定不同的名称(状态计数,比如说)并将其分组更改为计数。


-Stewart


当您发布时,我们会很容易您需要的示例如下:

展开 | 选择 | Wrap | 行号


感谢Stewart Ross Inverness和nico5038的帮助。

是的,实际上我想拥有与nico5038相同的结构,

但我不知道该怎么办。

其实状态有3个值。


1)准备

2)未准备好

3)没有什么


我已经完成了查询,但它不起作用。它仅显示Status Ready,

但状态未就绪且未显示任何内容。也许我的查询错了。


我的查询:


SELECT状态,计数(状态)AS状态1

从表1

WHERE(Status =''Ready'')

GROUP BY State


UNION


SELECT状态,计数(状态)AS状态2

来自表1

WHERE(状态=''未就绪'')

GROUP BY州


UNION


SELECT状态,计数(状态)AS状态3

FROM Table1

WHERE(Status =''Nothing'')

GROUP BY州;


任何人都可以帮助我吗?


Hi Everybody..

This is my firstime in creating report using microsoft access.
Actually i need to build a report based on a database call Table1.
I only use 2 column of databse to put in my report.

1) State
2) Status

For status, i need to separate it based on value of status;
Eg: 1)Ready
2) Not ready

I had create 2 query,one for ready and one for not ready.
I combine this 2 query into one query called StateStatus to build the report.

When i run or open to view the StateStatus query,the error message occur.I only can view it by design view.

Error:
The query can not be completed either the size of the query result is larger than the maximum size of databse (2GB) or there is not enough temprary storage space on the disk to store the query result.


Is it my step to create query for report is wrong?
How to solve to make the query can run or open.


Thank you.

解决方案

Hi. It sounds like you have accidentally multiplied your two queries when you tried to join them back to each other. This is known as the Cartesian product of the rows, and happens when you include the tables but neglect to join them on the relevant common field. I''m not sure what you want to do with the two fields you mention - Status and State - but the most obvious thing is to group by the values concerned and count the rows for each state.

You don''t need two queries to do this. Simplest approach is to use the Access query editor, add your primary table to the query, use View, Totals to select grouping and totalling, add the state and status fields, then add a copy of the status field, giving it a different name (Count of Status, say) and change its Group By to Count.

-Stewart


It would be easy for us when you would post a sample you need like:

Expand|Select|Wrap|Line Numbers


Thank you Stewart Ross Inverness and nico5038 for your help.

Yes, actually i want to have the same structure that had stated by nico5038,
but i dont know how to do.
Actually Status have 3 value.

1)Ready
2)Not Ready
3)Nothing

I already done the query but it is not work. It only show for Status Ready,
but Status Not Ready and Nothing are not showed. Maybe my query is wrong.

My query:

SELECT State, Count(Status) AS Status1
FROM Table1
WHERE (Status=''Ready'')
GROUP BY State

UNION

SELECT State, Count(Status) AS Status2
FROM Table1
WHERE (Status=''Not Ready'')
GROUP BY State

UNION

SELECT State, Count(Status) AS Status3
FROM Table1
WHERE (Status=''Nothing'')
GROUP BY State;

Anyone can help me?


这篇关于运行或打开查询时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆