无法显示来自"Select Count(*)"语法的记录 [英] Can't show the record from ' Select Count(*)' syntax

查看:85
本文介绍了无法显示来自"Select Count(*)"语法的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过语法"slot.id_slot,count(*)" Jumlah Bentrok"显示具有重复的"slot.id_slot"值的记录.但是,当我的语法为:
时,记录不会显示

I want to show a record that have a duplicate ''slot.id_slot'' value by syntax "slot.id_slot,count(*) ''Jumlah Bentrok ''". But the record doesn''t show when my syntax is :

SELECT  Jadwal.No_Jadwal, Kuliah.No,Doseen.Nama_Dosen , slot.id_slot,count(*) 'Jumlah Bentrok '
FROM Jadwal INNER JOIN Kuliah ON Jadwal.No = Kuliah.No INNER JOIN slot ON Jadwal.id_slot = slot.id_slot INNER JOIN  Doseen ON Kuliah.Id_Dosen = Doseen.Id_Dosen
group by Jadwal.No_Jadwal, Kuliah.No,Doseen.Nama_Dosen ,slot.id_slot having count(*) > 1



但是,记录显示了我的语法何时变为:



But, the record shows when my syntax becomes this:

SELECT [id_slot], count(*) 'Jumlah Bentrok'
  FROM [FKIP-UNILAK].[dbo].[Jadwal]
group by [id_slot] having count(*) > 1



有什么问题吗?
我必须从第一个语法显示记录:(



What is the problem?
I have to show the record from my first syntax :(

推荐答案

如果未显示记录,则问题必须出在您的内部join语句上.基本上,如果您所有的内部联接都不匹配,您将不会获得数据.如果我是您,我将分析您认为应该返回的数据,看看是否应该使用内部联接
If the record isn''t showing, the problem has to be with your inner join statements. Basically, if all of your inner joins don''t match, you won''t get data back. If I were you, I''d analyse the data you think you should be getting back to see if you should be using inner joins or left/right joins.


首先为连接创建一个view,然后执行count操作,这将有助于您划分和解决查询.

祝您好运.
First make a view for your join. Then perform the count operation. This will help you to divide and conquer your query.

Good luck.


我认为这可能是由于您的基础数据所致.既然您有3个内部联接,那么您可以不从任何一个开始,然后一次递增地添加一个联接吗?也许您将能够看到哪个联接正在断开它?
I think it may be due to your underlying data. Since you have 3 inner joins, could you start with none of them, and incrementally add joins one at a time? Maybe you will be able to see which join is breaking it?


这篇关于无法显示来自"Select Count(*)"语法的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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