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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Selecting values from two tables(Urgent)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-10 : 07:52:06
Vincent Twala writes "Good day,

I want to SELECT DISTINCT Section Name from tblEmployee. Equipment Name from tblHardware which are related by field PersalNo.My Query statement is:

sql=
"SELECT Distinct(tblEmployee.SecName),tblHardware.EquipName" & " FROM tblEmployee.pkiPersalNo = tblHardware.fkiPersalNo" & " ORDER BY SecName,EquipName"

It seems like the Distinct function is not working because I get duplicate values of Section Names. Please help.

Regards

Vincent"

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-02-10 : 10:04:39
In SQL Server DISTINCT is not a function but a declarative keyword. It will bring back DISTINCT rows the satisfy the query conditions so if an employee Section Name is "referenced" to more than one EquipName it will show up for each "reference."
Go to Top of Page
   

- Advertisement -