MS ACCESS VBA按案例订购的时间 [英] MS ACCESS VBA ORDER BY CASE When

查看:96
本文介绍了MS ACCESS VBA按案例订购的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很多orders in my Factory.

我们完成工作的正常时间是10天,但有时我们向客户保证会缩短工作时间(假设5天).

Our regular time to finish our job is 10 days but sometimes we promise to the customer that it will be shorter (lets assume 5 days).

我试图建立一个按minimum Date of the two columns顺序排列的SQL:

I tried to build an SQL that order by the minimum Date of the two columns:

SELECT id, Status, DeliveryDate, PromiseDate
FROM CustomerOrderT
WHERE Status > 2 and Status <7 
ORDER BY CASE WHEN DeliveryDate > PromiseDate then PomiseDate ELSE DeliveryDate END;

但是我从ms访问中收到一条问题消息.也许写正确 问题按摩贴

But i get a problem message from ms access. maybe write it correctly The problem massage attached

谢谢

推荐答案

在MS Access中,您必须使用IIF代替Case,例如:

In MS Access you have to use IIF instead of Case like this:

SELECT id, Status, DeliveryDate, PromiseDate
FROM CustomerOrderT
WHERE Status > 2 and Status <7 
ORDER BY IIF(DeliveryDate > PromiseDate, PromiseDate, DeliveryDate);

这篇关于MS ACCESS VBA按案例订购的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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