Need help in Sql Query optimization

I have below sql query which is running quite slow.used 3 tables in conjunction and have created first table a with same set of columns and 1 different and b table with same set of columns and 1 different and then joined these.Please help in optimizing or any other way to acheive the same.

That's not SQL Server / T-SQL code. This is a SQL Server / T-SQL forum. You'd likely get better help from a MySQL or Oracle forum.

Hi

You can break up the data
Example if you have 100 rows use 10 rows
At a time

You can also filter
Example if you have 100 rows
Use where name = Larry to reduce to 2 rows

Also
You can join two tables first
Get it to work fast
Then join to third table

These ideas are just three

Please Google search
You will find lots lots of articles
From which you can get ideas