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
 Other Forums
 Other Topics
 Convert this Access query to SQL Server

Author  Topic 

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2000-08-13 : 00:00:00
dBUDI writes "I want to convert the SQL command below (from ms Access 2000) to Stored Procedure(ms SQL Server 7.0)

EXAMPLE:

tables:
tbl_Master
NIK Name_of_Employee
111 dNita
222 Bariqi
333 Unietty
444 Datoen
555 Intan

tbl_Loan
NIK Date Amount
111 8/2/00 $100.00
111 8/8/00 $50.00
333 8/2/00 $225.00
444 8/2/00 $75.00
444 8/21/00 $30.00

SQL syntax:
SELECT tbl_Master.NIK, First(tbl_Master.Name_of_Employee) AS FirstOfName_of_Employee, Sum(tbl_Loan.Amount) AS SumOfAmount
FROM tbl_Master INNER JOIN tbl_Loan ON tbl_Master.NIK = tbl_Loan.NIK
GROUP BY tbl_Master.NIK;

output:
NIK FirstOfName_of_Employee SumOfAmount
111 dNita $150.00
333 Unietty $225.00
444 Datoen $105.00

my question is, how to get such output above by using stored procedure in SQL Server."


SQL Server doesn't support the FIRST function so you won't be able to use that. You also don't need the semicolon at the end. Other than that it should work fine in SQL Server.
   

- Advertisement -