Click here to Skip to main content
12,076,925 members (46,353 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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
isi19520
Edited 2-Nov-12 0:00am
Nelek90.6K
v2
Comments
Mehdi Gholam 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web03 | 2.8.160212.1 | Last Updated 2 Nov 2012
Copyright © CodeProject, 1999-2016
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