Hello,
I have following simplified table structure
CREATE TABLE [TERMINAL_SAYIM](
[LaptopId] [bigint] IDENTITY(1,1) NOT NULL primary key,
[AdresKodu] [nvarchar](30) NULL,
[BelgeNo] [nvarchar](30) NOT NULL,
[IslemTuru] [nvarchar](2) NULL,
[Barkod] [nvarchar](30) NOT NULL,
[SSCC] [nvarchar](30) NULL,
[OkutmaTarihSaati] [datetime] NOT NULL,
[KullaniciKodu] [nvarchar](30) NULL
)
This table holds information about warehouse counting. Normally, one SSCC has to be counted once. It has to be checked for correctness if same SSCC is counted by two different users. I would like to have a list where I can see double reading of same SSCC. I came up with a query as following, but that is not exactly what I want.
select sscc, KullaniciKodu
from TERMINAL_SAYIM
where
BelgeNo = '2017-12' and
IslemTuru = 'SA' and
AdresKodu = 'SAYIM'
group by sscc, KullaniciKodu
order by sscc, kullaniciKodu
Resulting following output
sscc KullaniciKodu
------------------------------ ------------------------------
(DEFAULT) K01
(DEFAULT) K02
(DEFAULT) K07
X K02
Y K03
Y K05
Y K06
(7 row(s) affected)
Above result tells me that I have problem with (DEFAULT) and Y. However, I would like a single line for each SSCC and number indicating different user counting next to it. If possible only numbers bigger than 1 would list me the final report of short list.
Any help is appreciated.
Edit: It is my mistake that I did not include resulting table. What I want as a result is below
sscc total
------------------------------ ------------------------------
(DEFAULT) 3
Y 3
(2 row(s) affected)