Question

Asked on 2005-11-22 at 08:33:32ID: 25470037

Joining the results of two queries

by: Alistair_Williams250

Rating7.8Very Good

Hi

I Have two queries that perform counts. The first query returns 22 and the second 57. How can I get the overall count i.e (22+57). I tried Union, but that just returns the results in two rows.

Thanks

Alistair

SELECT count(*)
FROM pcms_chdoc_data pcm, pcms_chdoc_data tdrs,pcms_chdoc_related_chdoc
LINK WHERE ((tdrs.ch_uid = LINK.from_ch_uid)          
AND (LINK.to_ch_uid = pcm.ch_uid)          
AND (pcm.status IN ('RAISED', 'SCHEDULED', 'FAILED TESTING'))          
AND (pcm.ca_priority IN ('1', '2'))          
AND (pcm.target_release LIKE '15.0.0')
AND (tdrs.ch_doc_type LIKE 'TDR'))



SELECT count(*)
FROM pcms_chdoc_data pcm, pcms_chdoc_data tdrs,
pcms_chdoc_related_chdoc rel
WHERE (    (tdrs.ch_uid = rel.from_ch_uid(+))
AND (rel.to_ch_uid = pcm.ch_uid(+))
AND (tdrs.ch_doc_type LIKE 'TDR')
AND (tdrs.tdr_release_detected LIKE '15.0.0')
AND (pcm.ch_doc_id IS NULL))

  1. Table Join
    I am trying to find records in which addr1, addr2, city, state, zipcode having count > 2 If there are any null values(for addr2,city,state..etc) returned for some columns by B the query below does not return any records : the first join returns data where a.ca_line_1_addr = b.ca_line_1_addr but when I add sec…
  2. Combining two Oracle queries into one; JOINING…
    Hello, Have the two queries listed below, need to combine the two if possible, each db has its own un/pw/connection. Is that possible? If not any thoughts how to combine the two before returning a result? Thanks
  3. Help required in joining two statement in Oracle A…
    Hi! I need some help to join two statements. In Code 1 (attached), it's giving me the following four columns e.g. Registration_ID, UNIT, Total_Consideration and Property_Name In Code 2 (attached), it's giving me the following three columns e.g. Registration_ID, Customer_Name and Total_Consideration. I would like to joi…
  4. JOINING TWO TABLES
    Hi , I need help joining two tables and selecting data from them . The tables are listed below. The inofrmation I need are line_id,shipper,consignee where category=I and status-F . Any help is greatly appreciated . thanks,Gyans
  5. Joining the result of Aggregate function with a qu…
    Currently, I have a query like this: with data as( select o.id, o.created created, o.care, l.created lcreated, o.electronic, l.orderid lorderid, l.stateid , l.userid, r.id rid, r.orderid rorderid, r.created response, r.responsetypeid, rs.id rsid from orders o, logs l, responses r, responsetypes rs where o.id = R…

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
queries two joining results
Participating Experts
3
Solution Grade
A

Replies

 by: pennnn

Posted on 2005-11-22 at 08:37:07ID: 28296289

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by:

Posted on 2005-11-22 at 08:42:09ID: 28296290

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: DrSQL

Posted on 2005-11-22 at 10:00:17ID: 28296291

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: DrSQL

Posted on 2005-11-23 at 06:28:30ID: 28296292

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert