Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi guys

I have two tables

A B
dbo.Items dbo.Staff
ItemID StaffID
StaffID Lastname
Itemname Firstname
Unit City
Quantity Company

I made a key in dbo.Items to take values from dbo.Staff
I want to make a report with store procedure so that every StaffID to take
only his own items.
Parameters Company,City,Lastname

Please any help is welcome
Posted
Comments
Johnny J. 20-Jun-13 4:03am    
People here don't work for free. This site might be of help to you:

http://www.rent-acoder.com/

Otherwise, try to do something yourself and ask when you get stuck at something specific.

1 solution

Use Join
as

SQL
Create proc usp_select_items
(
@ComanyName varchar(50),
@City varchar(50),
@LastName varchar(50)
)
as
begin
select *from dbo.Staff s inner join dbo.Items i on s.StaffID=i.StaffID where s.ComapnyName=@ComapnyName and s.City=@City and s.LastName=@LastName
end
 
Share this answer
 
Comments
jomachi 20-Jun-13 4:08am    
Thank you for responce Ι will try it.
KuttiSankar 20-Jun-13 5:27am    
can u specify the tables seperately, that will help to understand your requirement
jomachi 20-Jun-13 5:31am    
My problem solved thanks to Uma Shankar Patel.
Your procedure was correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900