Click here to Skip to main content
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 22:33pm
isi19460
Edited 2-Nov-12 0:00am
Nelek59.6K
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)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 2 Nov 2012
Copyright © CodeProject, 1999-2014
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