Hi all,
I have a TSQL code which takes 1 min 20 sec. Kindly let me know the possibilities to increase the performance at least query runs in 20 to 30 sec. please find the below query:
DECLARE @Temp table ( ) /* --Get All the transfer in and out patients except bed moves (where from and to locations are same) */ INSERT INTO @Temp ( ) SELECT (
) FROM A WHERE ( AND ) /* ----Get REST (ignore patients who were already listed in transfer in or out) of the patients with bed moves (where from and to locations are same, ----2 records one for out and one for in will be created in each case so just getting transfer in i.e movementTypeCd 30 to avoid duplicate records ) */ INSERT INTO @Temp
SELECT (
)
Please post this query with CTE or any other techniques would help.
Thanks.
- Edited by BI-Help 7 hours 46 minutes ago