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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-06 : 09:45:23
|
Shoaib Khan writes "I am using Access as databaseI have a table called employee which has departmentID,OfficeID in it. "Select departmentID,department from department where cint(DepartmentID) = '"&dep&"'"here dept = all the departmentID of employees of a certain OfficeHere more then 2 employee have the same departmentID when I compare the value stored in a varible and in result I get more then 1 departmentID. I need a query in the above sql statment which will only show the departmentID once and skip the repeating of that ID. I have tried Descreat too but no use.thanksShoaib Khan" |
|
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2002-08-06 : 11:24:39
|
Not quite sure what your getting at but how about SELECT TOP 1 ...........Paul |
 |
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2002-08-07 : 08:03:39
|
If I understand you correctly, your results look something like this:departmentID, department1, Sales2, Accounting3, Marketing1, Sales2, AccountingAnd you are wanting this:departmentID, department1, Sales2, Accounting3, MarketingIf this is a correct assumption, try the following:"Select departmentID,department from department where cint(DepartmentID) = '"&dep&"' GROUP BY departmentID,department" or "Select DISTINCT departmentID,department from department where cint(DepartmentID) = '"&dep&"'"I think the first one should be OK in Access. Not sure the second one will work in Access.JeremyEdited by - joldham on 08/07/2002 08:05:27 |
 |
|
|
|
|
|
|