Query does not work in: interactive report _ APEX

Hello

I have two table QB_COLLEGE_DETAILS and QB_STUDENT_DETAILS, in the college details are stored in the QB_COLLEGE_DETAILS table and by studying the details are stored in the QB_STUDENT_DETAILS table. In the primary key table and foreign key in the COLLEGECODE.  Now, I created the interactive report using code below, but does not receive the correct value in the number of student column (see image below).

SELECT COLLEGENAME, COLLEGECODE, COORDNAME, COORDEMAIL,

(SELECT count (s.STUDENT_REGISTER_NUMBER) AS STUD_COUNT of QB_COLLEGE_DETAILS c, s QB_STUDENT_DETAILS

where c.COLLEGECODE = s.COLLEGECODE) "STUDENT_COUNT".

of QB_COLLEGE_DETAILS;

Report.JPG

My requirement is necessary find the number of students at the corresponding College. When I used above mentioned request that total student number appear in all lines.

could you add your suggestion, I have to do?

Thank you

Issac

ISSAC-Oracle wrote:

I have two table QB_COLLEGE_DETAILS and QB_STUDENT_DETAILS, in the college details are stored in the QB_COLLEGE_DETAILS table and by studying the details are stored in the QB_STUDENT_DETAILS table. In the primary key table and foreign key in the COLLEGECODE.  Now, I created the interactive report using code below, but does not receive the correct value in the number of student column (see image below).

SELECT COLLEGENAME, COLLEGECODE, COORDNAME, COORDEMAIL,

(SELECT count (s.STUDENT_REGISTER_NUMBER) AS STUD_COUNT of QB_COLLEGE_DETAILS c, s QB_STUDENT_DETAILS

where c.COLLEGECODE = s.COLLEGECODE) "STUDENT_COUNT".

of QB_COLLEGE_DETAILS;

My requirement is necessary find the number of students at the corresponding College. When I used above mentioned request that total student number appear in all lines.

could you add your suggestion, I have to do?

What you need to do is ask questions properly, providing useful information that allowing the problem can be reproduced, rather than unnecessary screenshots.

This is the base of SQL. Oracle run internal SQL training courses?

There is no correlation in your "virtual column" subquery to restrict the number of students for each college. The request must be:

select
    c.collegename
  , c.collegecode
  , c.coordname
  , c.coordemail
  , (select count(s.student_register_number) as stud_count from qb_student_details s where c.collegecode = s.collegecode) "STUDENT_COUNT"
from
    qb_college_details c

However, unless there are a large number of colleges to which no students registered, it is likely that it will be more efficient to use an outer join:

select
    c.collegename
  , c.collegecode
  , c.coordname
  , c.coordemail
  , count(s.student_register_number) student_count
from
    qb_college_details c
      left outer join qb_student_details s
        on c.collegecode = s.collegecode
group by
    c.collegename
  , c.collegecode
  , c.coordname
  , c.coordemail

Tags: Database

Similar Questions

  • Correlation query does not work

    create the table cust_age_sal (cust_id integer, integer whole age of sal);

    create the table new_cust_age_sal (cust_id integer, integer whole age of sal);

    insert into cust_age_sal values (1,10,100);

    insert into cust_age_sal values (2,20,200);

    insert into cust_age_sal values (3,30,300);

    insert into cust_age_sal values (4,40,400);

    commit;

    insert into new_cust_age_sal values (2,21,201);

    insert into new_cust_age_sal values (3,31,301);

    commit;


    Question

    I want to update cust_age_sal using the customer_id which are present in the new_cust_age_sal;

    I use queries, query1 and query2. Query1 is working and I get results and I want to know what is the problem with query2 and why it does not work

    Query1:

    UPDATE cust_age_sal u

    SET (age, sal) =

    (

    SELECT age, sal

    OF new_cust_age_sal

    WHERE cust_id = u.cust_id

    )

    where u.cust_id in (select cust_id from new_cust_age_sal)

    ---

    query2:

    UPDATE cust_age_sal

    SET (age, sal) =

    (

    SELECT age, sal

    OF new_cust_age_sal

    WHERE cust_id = u.cust_id

    )

    Hello

    2742751 wrote:

    It is except o/p I'm looking

    O/p: except

    I think you want to say "whereas", not "excluded".

    CUST_ID AGE SAL

    ---------------------- ---------------------- ----------------------

    1                      10                     100

    2                      21                     201

    3                      31                     301

    4                      40                     400

    But when I run under query that is show below output even if I use the join on the target table condition. Why is it show empty for CUST_ID = 1 and 4

    UPDATE cust_age_sal u

    SET (age, sal) =

    (

    SELECT age, sal

    OF new_cust_age_sal

    WHERE cust_id = u.cust_id

    )

    CUST_ID AGE SAL

    ---------------------- ---------------------- ----------------------

    1

    2                      21                     201

    3                      31                     301

    4

    A UPDATE instructions without WHERE clause will update with each row in the table.

    In the case of cust_id = 1, what will that do?  Well, what makes the following query?

    SELECT age, sal

    OF new_cust_age_sal

    WHERE cust_id = 1;

    ?  It produces no line.  When you use a subquery in a SET of an UPDATE statement clause (as you do) and the subquery returns no rows, then updated the columns with a NULL value.

    If you don't want to update all rows, but want lines updates which fulfil certain conditions (for example, have a corresponding row in new_cust_age_sal), and then use a WHERE clause in the UPDATE statement, as you did in your first UPDATE statement.

    Instead of an UPDATE statement, you can also use a MERGE statement, like this:

    MERGE INTO dst cust_age_sal

    With the HELP of new_cust_age_sal CBC

    WE (dst.cust_id = src.cust_id)

    WHEN MATCHED THEN UPDATE

    SET dst.age = src.age

    dst.sal = src.sal,

    ;

    In this way, you don't need to repeat what is essentially the same subquery in the GAME and WHERE clauses.

  • Query does not work on my iPad (was: media query question)

    I am a site for mobile/tablet/Office of coding and while my office and the iphone respond to the CSS, my ipad does not work. The changes that I do take the tablet in dreamweaver, but when they go live the ipad does not. Of course, my media query must be incorrect, but I can't understand the question. Any help is very appreciated.

    http://gbetza.mydomain.com/WebService2/test/KathrynFee/2014/profile.html

    Thank you.

    Yes.  It is inevitable because smart phones are getting bigger while tablets are smaller & more.  He's always going to be some crossover.   Think of it this way, when a Tablet is behaving as a mobile device, he takes over the mobile network.  When the shelf behaves more like a desktop computer, you need the layout of office.

    Similarly, a great smartphone in landscape mode is likely to resemble the layout of your tablet.

    See the FluidGrid example below:

    http://ALT-Web.com/FluidGrid/Fluid2.html

    Office = 4-col layout

    Tablet = 2-col layout

    Mobile = 1-col layout

    For purposes of illustration, I added a thick border of gold at the disposal of the Tablet only.

    / * Tablet Layout: 481px to 768px. Inherits the styles of: Mobile layout. */

    @media only screen and (min-width: 481px) and (max-width: 768px) {}

    .gridContainer {width: 92%; border: 16px solid gold}

    }

    Nancy O.

  • WS 2.0 query does not work

    Hi all

    I have a small problem...

    I'm trying to create a query with ws 2.0 but I Don t get a response but the 400 error message.
    The connection works very well and I also get my session ID, but when I try to do a query it always comes with the
    Server returned HTTP response code: 400 for URL: https://secure-ausomxgva.crmondemand.com/Services/Integration/CustomObject5;jsessionid=4e06330622aaf934c2068a7b02766c1c0a5eda9a04782b201b63fba91893bb80.e3iRbxiPbxj0bNaKaxaSa3n0;

    I Don t know why it does not work... my SOAP Message I send to the system looks like this:

    <? XML version = "1.0" encoding = "utf-8"? >
    < xmlns:soap: envelope soap = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance".
    xmlns:WSSE = "http://schemas.xmlsoap.org/ws/2002/xx/secext" container = "http://www.w3.org/2001/XMLSchema".
    SOAP: encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" >
    < soap: Body >

    < CustomObject5QueryPage_Input xmlns = "urn: crmondemand/ws/ECB/customobject5/10/2004" >
    < ListOfCustomObject5 xmlns = "" urn: / crmondemand/CustomObject5/query/xml "pagesize ="100"recordcountneeded ="true"startrownum ="0">"
    < CustomObject5 searchspec = "[CustomObject5Id] AS ' *'" >
    < CustomObject5Id / >
    < / CustomObject5 >
    < / ListOfCustomObject5 >
    < / CustomObject5QueryPage_Input >

    < / soap: Body >
    < / envelope soap: >

    I programmed in Java. The Soap Action is "document / urn: crmondemand/ws/customobject5/10 / 2004:CustomObject5QueryPage.
    I hope someone can help me or identifies an error...

    If you want more information, just ask. I'm looking for this error several hours now without success...

    Thank you very much in advance!

    You could try changing your SOAPAction header to
    "document / urn: crmondemand/ws/ECB/customobject5/10 / 2004:CustomObject5QueryPage.

    Also, you should be able to recover the additional error information in your application. When I tried a request with the HTTP SOAPAction header that you use, I got the following error message:

    The remote server returned an error: bad request (400).

    The HTTP request did not contain a valid SOAP action header. The value of the header has been "document / urn: crmondemand/ws/customobject5/10 / 2004:CustomObject5QueryPage.

  • WITH query Clause does not work in Oracle reports.

    Hi gurus,

    I use a query WITH clause and want to create a report by using the same query.

    But when I am trying to build a report, request gives error like "WITH clause table or view does not exist.

    But the same query works perfectly in line of sql.

    Does support the Oracle WITH clause query reports?

    Please suggest.


    Thank you
    Onkar

    I met a similar problem before and worked around it by moving the query to a pipeline function in the database as described in the unexpected CLAUSE causes ORA-00942 in Report Builder

    I hope this helps.

  • Why bind variables/page items does not work in the report query?

    Hello world

    I am trying to use the page as a bind variable in the query of my report. I checked the box to state of Session and also added my page elements in the LIST of ITEMS in the SESSION STATE.

    but NO RECORD not DISPLAYED IN THE REPORT at RUN TIME.

    to see live please connect to

    http://Apex.Oracle.com/pls/Apex/f?p=52297:LOGIN_DESKTOP:8355343133792

    user name: [email protected]

    password: 123456

    Hello

    I looked at the application.

    Do you want to go to the report page after click on the report button? If it is, your button to submit the page. Then, you need a branch to access this URL. By submitting the page, your value should be set at the session.

    Kofi

  • Email does not work after upgrade to the APEX

    Operating systems: Windows 2003
    DB: 11 GR 1 material

    E-mail no longer works for users after upgrade from 4.0 to 4.1. New APEX_040100 'main' added to the ACL as well as the main APEX_040000 of the previous version. In fact, the two still exist in the ACL.

    Error code in the APEX Admin Mail queue: ORA-24247: access denied by access control (ACL) of network list

    What could be the cause of the installation of electronic mail within the APEX to not work?
    See you soon!

    See what {message identifier: = 10355015}

  • Classic report, query does not work

    Hello

    I have a query that allows to choose from a table manufacturing exists in the other. It works in another query editor. But not in the Apex or in classic report page.

    SELECT q.user_name, COUNT (*) say
    OF kom_qabz.kom_qabz q
    WHERE q.amount IS NOT NULL
    AND THERE ARE
    (SELECT 1
    FROM: kom_qabz.kom_qabz_history
    WHERE h.copy_time > = TO_DATE ('20120803', 'YYYYMMDD') - 1
    AND h.copy_time < TO_DATE ('20120803', 'YYYYMMDD')
    AND h.qabz_number = q.qabz_number
    AND h.seriya_id = q.seriya_id)
    GROUP BY q.user_name

    Is there any problem?

    Hello

    Has received the kom_qabz schema for the workspace of the application when you generate the report?

    See you soon,.

  • Query does not work in MySql

    I have a script of calendar that I use to get the numbers in the table and showing them in a calendar. The query works in Access, but not in MySql. What is the problem with the syntax?

    Error: [MySQL] [ODBC 3.51 Driver] [mysqld - 4.0.26 - standard], you have an error in your SQL syntax. Consult the manual for your version of the MySQL server for the right syntax to use near ' (date_added) LIKE dd FROM estar_pledge WHERE date_a

    I'm really confused, if any help on that would be great, thanks.

    Chris

    Mysql documentation:
    Day (date)

    Day() is synonym for DAYOFMONTH(). It is available from MySQL 4.1.1.
    HTH
    --
    Tim Carley
    www.recfusion.com
    [email protected]

  • video does not work on interactive

    I can't load a video on an interactive PDF of InDesign InDesign CC 2014.  I looked at a number of sites in the event of problem, and the best I could figure, it's that maybe my Indesign program had a glitch. If I first tried 'screw up' my InDesign preferences.  That didn't do it.  I then uninstalled ID like to suggest many forums, and then I reinstalled it again with my cloud access adobe creative. But, again, same thing. I tried to move the video file to another folder, rename and try again. I tried a different version of videos (.mov, mp4, etc.). I tried to import the video file into a blank indesign document in case there was trouble with other files that I had placed before the video... Same thing, every time.

    I use a MacBook Pro, OS X 10.9.5; a lot of memory, a lot of processing speed... help?  Even my instructor on Adobe Ed Exchange is puzzled... and she sent me here...

    Before getting too deep into troubleshooting InDesign, it is possible that you have not worn either the film properly, you have exported it wrong or you are trying to view it properly.

    1. the video should be MP4, H264 encoding. You can use Adobe Media Encoder to resave the movie if necessary.

    2. use a file > Place. He discovers in the media Panel. Set the poster and controller settings.

    3 Preview in the preview of the EPUB interactivity Panel or Panel Preview SWF.

    4 export as Adobe PDF (interactive).

    5. display in Adobe Acrobat or Adobe Reader. Other PDF viewers may not displayed properly.

    You have to take these measures?

  • Update query does not work (ora-01427)

    RDBMS 10 g 2

    Long story short, I created a column in a table in another table, that it has been moved is not really necessary that all other information is stored in other tables. With the original column has values that need to be copied to the new column before the old table is deleted.

    I use this update query:
    update bi_req bir
       set bir.job_name =
            (select distinct bij.job_name
               from bi_jobs bij,
                    bi_freq bif,
                    bi_apps bia,
                    bi_req  bir
              where bij.fk_bi_req_id = bir.pk_bi_req_id
                and bia.pk_bi_apps_id = bij.fk_bi_apps_id
                and bif.pk_bi_freq_id = bij.fk_bi_freq_id)
     where bir.job_name is null;
    If I run the select statement separately, I get the exact results that I need however, every time I run the whole statement, I get:
    Error: ORA-01427: single-row subquery returns more than one row

    The problem is that your subquery returns two or more names different jobs for a line of update.

    Which of these task names are you using? If it is not serious, then you can go with a like this aggregate query

    update bi_req bir
       set bir.job_name =
            (select max(bij.job_name) /* use just one job name */
               from bi_jobs bij,
                    bi_freq bif,
                    bi_apps bia
            where bij.fk_bi_req_id = bir.pk_bi_req_id
                and bia.pk_bi_apps_id = bij.fk_bi_apps_id
                and bif.pk_bi_freq_id = bij.fk_bi_freq_id)
     where bir.job_name is null;
    

    What I don't understand is why you need the bi_freq and bi_apps in the subquery. A simple query as follows: should not be enough?

    update bi_req bir
       set bir.job_name =
            (select max(bij.job_name) /* use just one job name */
               from bi_jobs bij
            where bij.fk_bi_req_id = bir.pk_bi_req_id)
     where bir.job_name is null;
    

    Published by: W. Sven on September 4, 2009 14:06

  • SQL query does not work coccrectly

    The table contains the list of months and years.
    When I write
    SOME MONTHS, YEAR FROM MONTH_DETAILS ORDER BY DESC, YEAR DESC;
    It works correctly and returns
    MONTH YEAR
    7 2009
    6 2009
    5 2009
    4 2009
    3 2009
    2 2009
    1 2009
    12 2008
    11 2008
    But when I want to get only the first (month = 7 and year = 2009) and change the query like this
    SOME MONTHS, the YEAR OF MONTH_DETAILS WHERE ROWNUM = 1 ORDER BY YEAR DESC, DESC;
    It returns
    MONTH YEAR
    2 2009
    .
    What is the problem?
    The year and month fields are defined as numbers.
    SELECT MONTH,YEAR FROM (select * from MONTH_DETAILS ORDER BY YEAR DESC,MONTH DESC) WHERE ROWNUM=1 
    

    first make order and apply the rownum on him...

    Ravi Kumar

  • That means 1e9 and why this query does not work?

    What does 1e9? Someone has links to documentation on this oracle? And why I get this error?
    SQL> select segment_name,(bytes/1e9) AS size from dba_segments where segment_name='MSG_MASTER';
    select segment_name,(bytes/1e9) AS size from dba_segments where segment_name='MSG_MASTER'
                                       *
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected

    SIZE is a keyword - so if you want the name of the column size then use 'SIZE' else give it a different name

    Try dividing by other exponentials, then you'll see how: 1e0 1e1 (div 1), (div by 10), 1e2 :-) etc

    Mette

    Published by: mettemusens on 2009-05-12 16:02

  • Why this query does not work on the CF when it works fine on MYSQL?

    Subject says it all. I can run it through console mysql and get the result that I need, but when I place it inside a cfquery that he will not treat.

    SET @saldo = 20000;
    SELECT
    IF (Co.transtipo=0,@saldo:[email protected],@saldo:=@saldo+t.transmonto),
    @saldo: = @saldo - t.transmonto.
    t.TransID,
    t.cuentaid,
    t.operacionid,
    t.fechatrans,
    t.voucher,
    t.cheque,
    t.transtitular,
    t.transmonto,
    t.transdetalle,
    t.modificado,
    Co.transtipo,
    Co.Operacion
    OF cuentastrans t
    LEFT JOIN cuentasoperacion co ON t.operacionid = co.operacionid
    WHERE the t.cuentaid = 7
    ORDER BY t.fechatrans ASC

    Fixed, coldfusion must be labeled with 'AS' of the expressions in the opposite case he used to index the column.

  • SQL query does not work well

    Hello
    I did a small table with 5 rows and want to make a consult sql using rownum

    so I'm running
    select * from mytable where rownum = 1;
    and it gives me the first line but if I change the 1 to a 2 or 3 or 4 or 5, it is said that there's nothing: S

    why?????????????????????

    But if I change to between 1 and 5, he gave me 4 rows: S: S

    why???????????????????

    Try this:

    SELECT *
    FROM (
       SELECT bne.*, rownum myrow
       FROM BAN_EVENTOS_CONFIRMACION bne WHERE ROWNUM <=5)
    WHERE myrow = 2;
    

Maybe you are looking for

  • iCloud duplicates

    Hello This is a fundamental question, but humor to please me. I currently have iCloud library enabled on my iPhoneSE and it syncs well... Well, iCloud. My iPhone itself fills up quite quickly, however, and I would like to erase the space by removing

  • Disable redirection

    While browsing, I often get this message: "Firefox prevented this page automatically redirecting to another page." How to disable this option?

  • Lost Toshiba Recovery CD - how can I get another?

    How can I get another?

  • Need help with adapters for T60 wireless

    Hello! I recently came across a T60 and I need it to be able to 5 GHz Wireless. The wireless current is not. I'm not a genius when it comes to wireless cards, where they are and whether or not they are compatible, this is why I come to you! Will you

  • Cannot search for windows update, error800700B7

    Original title: Vista 2. Windows Update says first major update but cannot search updates. I get error code 800700B 7. I fight with my laptop Acer Aspire 5313 since before the new year, trying to get my Media Player to work... trying to get my update