473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

union query taken more time

Hi all,
i m using union query in asp page but that is taking morte time n slows down the server.
plz help me how can i overcome from this problem.this query is using many joins....this is urgent....
thanks

this is the query:-

select t.tid as tid, t.tenderno as tenderno,t.dt_publish as pubdt,wd.dt_submit as dts, t.dt_announce as pdt, t.flag as flag, wd.workno as workno, wd.title as title, l.name_org,cw.dt_submit as newdate, corrigendum =case when cw.workno is null then 0
else cw.workno end, cw.cno from tender t join workdesc wd on t.tid =wd.tid join login l on l.id =t.orgid left outer join (select tid, workno,dt_submit, max(corr_no) cno from corr_workdesc group by tid, workno, dt_submit) cw on wd.tid =cw.tid and wd.workno =cw.workno
where t.flag='Y'
union
select t.tid as tid,t.t_ref_no as tenderno,t.publish_date as pubdt,t.last_submit as dts,t.first_a_date as pdt,
t.flag as flag,t.workno as workno,t.t_title as title,l.name_org,cw.last_submit as newdate,
corrigendum =case when cw.workno is null then 0 else cw.workno end, cw.cno from tender_dtls t
join login l on l.name_org =t.orgname left outer join (select tid, workno,last_submit,
max(corrno) cno from corrigendum_dtls group by tid,workno,last_submit) cw on t.tid =cw.tid
and t.workno =cw.workno where t.flag='Y' order by pubdt desc,tid asc,workno,newdate asc
Jun 22 '07 #1
1 1147
debasisdas
8,127 Expert 4TB
Create indexes on the important columns .
Jun 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jeff Blee | last post by:
I hope someone can help me get this graph outputing in proper order. After help from Tom, I got a graph to display output from the previous 12 months and include the average of that output all in...
2
by: mattytee123 | last post by:
I have about 20 tables, of which I would like to do a union query and count of how many of each different code there is? The simplified verson of the table is structured like this. Code ...
6
by: Neil Zanella | last post by:
Hello, I would like to know what the C standards (and in particular the C99 standard) have to say about union initializers with regards to the following code snippet (which compiles fine under...
2
by: Otto Blomqvist | last post by:
Hello ! I have two tables (which contains individual months' data). One of them contains 500 thousand records and the other one about 40k, 8 columns. When I do a simple query on them...
2
by: marco | last post by:
Dear List, as it seems, MS SQL as used in Access does not allow a select INTO within a UNION query. Also, it seems that a UNION query can not be used as a subquery. Maybe my (simplified)...
7
by: KoliPoki | last post by:
Hello every body. I have a small issue. Problem: I have a table with 4 descriptor columns (type). I need to formulate a query to retrieve a count for each type so I can group by...etc. The...
4
by: PaulR | last post by:
Hi, (re: DB2 LUW v8.1 fp8 optimisation Level2) Can anyone explain why the following difference have wildly different plans - this seems very fundamental) select p.part_number,...
1
by: bgreenspan | last post by:
Hi Everyone, I'm back for some more expert help. Here's what I am doing and what I tried. My database has entries with Contract Names and Expiry Dates, among other fields. I have a form...
1
by: ebasshead | last post by:
Hi Everyone I have four queries that Ive joined in a union query and want to add a date criteria ei between and including date A and date B. Ive tried a few things but getting errors. Can someone...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.