Click here to Skip to main content
11,648,785 members (76,056 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server VB.NET
I am currently trying to create a view(SQL) in which i can get the count of products and from the count be able to show any products which the count is greater than 1.

[edit]additional OP's information moved from non-solution[/edit]
I am not sure how to get the count of each product to show in the view

SELECT     <big>COUNT(dbo.Receiving.ManufacturerSerialNumber) AS Cnt</big>, dbo.Receiving.ManufacturerSerialNumber, dbo.Receiving.UserId, dbo.Receiving.WorkCompleted,
                      dbo.FullRepair.EngineersReportId, dbo.FullRepair.UserId AS Technician
FROM         dbo.Receiving INNER JOIN
                      dbo.FullRepair ON dbo.Receiving.ManufacturerSerialNumber = dbo.FullRepair.ProductSerial
Posted 1-Nov-12 21:33pm
isi19537
Edited 1-Nov-12 23:00pm
Nelek72.4K
v2
Comments
Mehdi Gholam at 2-Nov-12 3:35am
   
... and what is your problem?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Try something like this (check out HAVING):
SELECT COUNT(*) AS Cnt, 
       dbo.Receiving.ManufacturerSerialNumber, 
       dbo.Receiving.UserId, 
       dbo.Receiving.WorkCompleted,  
       dbo.FullRepair.EngineersReportId, 
       dbo.FullRepair.UserId AS Technician
     FROM dbo.Receiving, dbo.FullRepair
     WHERE dbo.Receiving.ManufacturerSerialNumber = dbo.FullRepair.ProductSerial
     HAVING COUNT(*) > 1;
Good luck!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I have found a solution thanks
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 F-ES Sitecore 354
1 OriginalGriff 324
2 Kornfeld Eliyahu Peter 309
3 CPallini 295
4 Sergey Alexandrovich Kryukov 254
0 OriginalGriff 1,577
1 Sergey Alexandrovich Kryukov 1,087
2 CPallini 1,015
3 DamithSL 996
4 jyo.net 994


Advertise | Privacy | Mobile
Web04 | 2.8.150804.4 | Last Updated 2 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100