如何在sql中编写查询以从表中选择相同的记录

时间:2017-05-12 08:06:02

标签: mysql

为了帮助确定今年第一季度的财务记录,管理层需要了解尚未支付费用的候选人才能与他们联系。

对于这个问题,我写了一个查询:

internal class Program
    {
        private static void Main(string[] args)
        {
            //my test Api supports gzip
            var target = "http://10.100.0.92:62872/api/TestZipPost";
            var client = new RestClient(target);
            var request = new RestRequest(Method.POST);
            var response = new RestResponse();

            Task.Run(async () => { response = await GetResponseContentAsync(client, request) as RestResponse; }).Wait();

            //write response "AAAAAAAAA"
            Console.WriteLine(response.Content);
        }

        public static Task<IRestResponse> GetResponseContentAsync(RestClient theClient, RestRequest theRequest)
        {
            var tcs = new TaskCompletionSource<IRestResponse>();
            theClient.ExecuteAsync(theRequest, response => { tcs.SetResult(response); });
            return tcs.Task;
        }
    }

但是说错误

  

#1054 - 未知列&#39;付费&#39;在&#39;字段列表&#39;

任何人都可以帮我纠正我的查询

1 个答案:

答案 0 :(得分:1)

fieldname中有一个空格,因此您必须使用字段名称分隔符。

在mysql中你需要反引号`so

SELECT ENROLL_FEEPAID, COUNT(`Not Paid`) FROM ENROLL GROUP BY `Not Paid` HAVING ( COUNT(`Not Paid`) > 1 );