当另一列具有重复值时,检查其他列上的升序

时间:2016-12-06 13:52:35

标签: sql ms-access duplicates rows

我有一个只有一个表的Access数据库。该表由2个字段组成。 IG_NumberTimeOfArrival

IG_Number: 0,1,2,3,4

例如,我的字段的值为TimeOfArrial: 12,15,19,5,19TimeOfArrival。我有一个代码,这个SQL命令用于按升序排序SELECT * from myTable ORDER BY (TimeOfArrival); 字段:

---------------------------
IG-NUMBER | TIMEOFARRIVAL |
---------------------------
3            5
0            12
4            19
1            19
---------------------------

这给了我两张表的结果

TimeOfArrival

但我的问题是,如果19表中有重复项,例如TimeOfArrival。如何根据IG-Number的重复次序的升序排列------------------------- 4 19 1 19 ------------------------- 的升序?

这样,而不是

----------------------
1                  19
4                  19
---------------------

我会

 import com.sun.deploy.net.HttpResponse;

public class Test {
public static void main(String args[]) {
    CloseableHttpClient httpclient = null;
    CredentialsProvider credsProvider = new BasicCredentialsProvider();
    credsProvider.setCredentials(new AuthScope("[target-url-domain]"), AuthScope.ANY_PORT),
            new UsernamePasswordCredentials("usrename", "password"));
    credsProvider.setCredentials(new AuthScope("[proxy-domain]"), AuthScope.ANY_PORT),
            new UsernamePasswordCredentials("usrename", "password"));

    SSLcontextBuilder builder = new SSLCOntextBuilder();
    SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build);

    httpclient = HttpClients.custom().setSSLSocketFactory(sslsf)
            .setDefaultCredentialsProvider(credsProvider).build();

    String url = "targetUrl";
    HttpGet httpGet = new HttpGet(url);
    RequestConfig config = RequestConfig.custom().setProxy(new HttpHost("[proxyUrl]", 89)).build();
    httpGet.setConfig(config);
    HttpResponse resp = httpclient.execute(httpGet);
}

1 个答案:

答案 0 :(得分:2)

IG-NUMBER添加到order by

Order by TimeOfArrival asc,IG-NUMBER asc

第一个结果将由TimeOfArrival订购,然后在IG-NUMBER

之后再次对结果进行排序