Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
duanecwilson
Constraint Violating Yak Guru
273 Posts |
Posted - 2010-03-29 : 18:43:04
|
| I have a simple issue, but have a mental block. If I have a table with 2 columns, WorkstationID, and Product, and I want to select ONLY those workstations with more than one product installed on them (these are Office versions). Some workstations have 2 or more versions. If the Workstation only has 1, I don't want them. So the final result will have 2 columns - WorkstationID, Product. So it will look like this:WorkstationID, Product1656, Office XP1656, Office 20031656, Office 20071795, Office 20031795, Office 20071831, Office XP1831, Office 20032096, Office 20032096, Office 2007etc. - no entries where only 1 version installed.I have tried various sub-queries, group by, having, etc.Thanks in advance for helping.Duane |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2010-03-30 : 09:45:32
|
| select a.workstationid,a.productfrom TABLE ainner join(select workstationidfrom TABLEgroup by workstationidhaving count(*) > 1) bon a.workstationid = b.workstationidhttp://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|
|
|
|