Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL
select
it.C_Code,it.C_Name,
it.C_Pack,
gd.c_item_code,gd.n_qty from tbl_gdn_stock g
join tbl_gdn_stock_details gd on gd.n_srno=g.n_srno
inner join Tbl_Item_Mst it on it.C_Code=gd.c_item_code
where g.c_empid='4614' and g.c_year=2015 and MONTH(g.d_date)=01


While executing above query it takes a long time and does not display any data. Still it's showing that query is executing...
If I don't join tbl_item_mst result would be displayed..
Posted
Updated 8-Jun-15 20:49pm
v3

1 solution

Check the indexes on your tables, run the query in the SQL Profiler and see what indexes it recommends.

Other than the above there is very little we can help you with since we don't have relevant information and access to your actual system.
 
Share this answer
 
Comments
Member 11337367 9-Jun-15 1:46am    
Could you explain me how to execute in sql profiler beacuse i never tried this thing earlier.
Mehdi Gholam 9-Jun-15 1:54am    
https://msdn.microsoft.com/en-us/library/ff650699.aspx

http://www.codeproject.com/Articles/21371/SQL-Server-Profiler-Step-by-Step
Member 11337367 9-Jun-15 2:16am    
Please help me out how to analyze my query..
Member 11337367 9-Jun-15 2:16am    
is there query analyzer exist in ms sql?

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