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 |
|
shanmp
Starting Member
13 Posts |
Posted - 2008-08-08 : 03:40:34
|
| Hi all, I am new to the SQL server, I have a query regarding count function in SQL server. For example , I need to join the two tables and perform the count function, but when i executed the query its throwing an error. Select count(*) from (select distinct a.emp, a.empid, b.location, a.addrfrom emp a, location b where a.empid = b.empid)whereas the same function is working well in the Oracle SQL but not in SQL server. Please let me know how to call this function properly in SQL server since i have knowledge only on Oracle SQL and not in SQL Server. Thanks,Shanmp |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-08-08 : 03:42:04
|
| you just need to give an alias to the derived table...Select count(*) from (select distinct a.emp, a.empid, b.location, a.addrfrom emp a, location b where a.empid = b.empid) T Em |
 |
|
|
shanmp
Starting Member
13 Posts |
Posted - 2008-08-08 : 05:06:23
|
| Thanks just now i tried on my own too... thanks a ton for the imm response.. the forum is good. will keep posted in case of any queries :-) |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-08-08 : 05:19:12
|
hey, maybe we could swap. i'm struggling along translating my stuff into oracle at the min Em |
 |
|
|
|
|
|
|
|