April 3, 2014 at 8:02 am
I want to write fetch data through stored procedure where we have to join two table. for example in i want to write this query in stored procedure
SELECT myReport_1.id AS [ID]
,myReport_1.r_id AS [Report ID]
,login.Name, CONVERT(VARCHAR,myReport_1.date,106) AS Date
,myReport_1.job_name AS [Job Name]
,myReport_1.job_status AS Status
,myReport_1.Quantity
,myReport_1.Tot_time AS [Total Time Taken]
,myReport_1.center AS [Center Code]
FROM
login INNER JOIN myReport AS myReport_1 ON login.id = myReport_1.id
please suggest me
April 3, 2014 at 8:25 am
Without table definitions and without sample data, all we could do is say the query you provided should do the trick.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 3, 2014 at 9:00 am
should i have to send the schema of my both table ???
April 3, 2014 at 9:24 am
fatmazarin07 (4/3/2014)
should i have to send the schema of my both table ???
What is your actual question here?
Assuming the code you posted in your original post is what you want from your stored procedure then what you posted will work fine.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply