按升序对复杂查询进行排序 [英] Sorting a complex query in ascending order

查看:99
本文介绍了按升序对复杂查询进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个骑行计时程序。我从开始和结束计算中得到了正确的数据,但是很难在报告中对总时间进行排序。


就像这样。

- 骑自行车的人会绕着一个球场跑 - 最多8圈,具体取决于年龄分组。

-当第一个骑手完成他/她的总圈数时 - 显示为全跑在报告中,其他车手必须停止骑行,在完成当前一圈他们正忙着骑马。这可能意味着有人在第6圈,而其他人可能忙于5或4,甚至在比赛中退出比赛。

总冠军完成所有圈数,下一轮比赛在最短的时间内完成第二圈的骑手,排名第二等。

i有一个屏幕图片,其中我添加了完成位置1-10来解释位置和圈数和时间。

数据库也包括在内。

原则是,如果有人没有完成totallaps,那么根据需要(并在报告中列出),他们的结果应显示在完成正确总数的骑车人之下。问题是那些没有完成所需圈数的人将会缩短总时间,使得排序变得不可能。


我的想法是添加一个1。到另一个查询字段如果骑车者完成它并且0与0相关联,则链接到特定的拉片场。如果他们没有做一圈。然后你加起来完成和降序的圈数首先按顺序排序,然后按升序排列总时间。


我为此奋斗not is null 1,0在查询中编码。

试了这个没有成功

I have this cycling timing program. I get the correct data from my start and finish calculations, but is struggling to sort the total time in a report.

It works like this.
- A cyclist do laps around a course - up to 8 laps depending on age grouping.
-When the first rider finishes his/her total number of laps - shown as "totallaps" in report, the other riders have to stop riding, on completing the current lap they are busy riding. This may mean that somebody is on ie lap 6 while others may be busy with 5 or 4 or even pull out of the race if they are lapped.
The overall winner does all the laps, and the next rider with the 2nd most laps done in shortest time, is 2nd overall etc.
i have a screen pic included where I added finish positions 1-10 to explain the positions and laps and times.
The database is also included.
The principle is, if somebody does not complete the "totallaps" as required (and listed in report), then their results should appear below the cyclist who did complete the correct number of totallaps. The problem is that those that did not finish the required number of laps, will have a shorter totaltime, making sorting impossible.

My thinking is to add a "1" to another "query field" that is linked to a specific laptime field, if the rider does finish it and a "0" if they did not do a lap. You then "add up" the laps done and descending sort them first, followed by total time in ascending order.

I struggle with that "not is null 1,0" coding in the query.
Tried this without success

展开 | 选择 | Wrap | 行号

推荐答案

展开 | 选择 | Wrap | 行号


嗨gershwyn。

空白栏不给我一个零。值和具有laptime的列应该给我一个值1。

上面附带的示例有一个表,使用查询从该表创建报告(相同的格式/我使用的字段)。在减去每圈的完成时间和开始时间后,我将结果从另一个查询中添加到其中。它现在只是按特定顺序显示结果的情况。
Hi gershwyn.
The blank columns don''t give me a "zero" value and the columns that do have a laptime, should be giving me a value of "1".
The attached example above has a table from which the report is created using a query(same format/fields i used). I appended the results to it from another query, after subtracting finish and start times per lap. Its now just a case of displaying the results in a specific order.


您好neelsfer,


我无法下载您的示例。请在帖子中将相关详细信息发布为文本。 (发布你正在使用的Access版本也是一个好主意。我确定还有其他人可能会看一下,但是下载内容却发现你无法打开它是令人沮丧的无论如何。我使用2007年,但我知道这里的几位专家都坚持使用旧版本。)


我还没有太多可以继续下去,但可能是你的空白列不是null,而是空字符串。如果是这种情况,您的IsNull将始终返回false,并且您将始终获得1。结果是。您可以在一个测试中测试空字符串和空字符串:
Hi neelsfer,

I am not in a position to download your example. Please post the relevant details as text in your post. (It is also a good idea to post which version of Access you are using. I''m sure there are others who might take a look, but it''s frustrating to download something only to find you can''t open it anyway. I use 2007 but I know several experts on here are sticking with older versions.)

I still don''t have much to go on, but it may be that your blank columns are not null, but empty strings. If that is the case, your IsNull is always going to return false, and you will always get a "1" as a result. You can test for both null and empty strings in one test:
展开 | 选择 | Wrap | 行号


这篇关于按升序对复杂查询进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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