Make one query of two queries?

I have these two quries, how can I at the best way get the same result in one query?
--Querie 1
SELECT 'm' || Year_Month As Month,
Sum(NET_SALES) As "Net Sales"
FROM tlbInfo 
WHERE Year_Month Between '200709' And '200801'
And record_type IN ('A','X')
Group by Year_Month
Order by Year_Month
--Querie 2
SELECT 'm' || Year_Month As Month, 
Sum(STANDARD_MANUF_COST)/Sum(Case When SALES_QUANTITY <> '0' Then SALES_QUANTITY End) As "Cost",
to_char(100*((sum(NET_SALES)-sum(STANDARD_MANUF_COST))/sum(NET_SALES)) || '%') As "Margin"
FROM tlbInfo 
WHERE Year_Month Between '200709' And '200801'
And record_type NOT IN ('A', 'X')
And Net_Sales >0
Group by Year_Month
Order by Year_Month

why did you change the 1st query? now you're further from getting the correct answer (not to mention that now my previous post makes no sense).
put the 1st query back to the way it was. then change the 2nd query to remove the record_type and net_sales criteria from the where clause, and instead put the logic into the select, via a CASE, like the first query is written.
now look at the two new queries, and ask yourself, what's so hard about making one query?
and don't do this work in the original post. do it in notepad. and if you want to post the new queries here to get further help, hit the REPLY button, NOT THE EDIT BUTTON

Similar Messages

  • Make one query from two

    Hi,
    Could you help optmize this query. If possibel.
    I have three tables: GROUP, GROUP_X_USER, USER.
    If there is a relation between GROUP and USER, it will be stores at GROUP_X_USER.
    Example:
    <tt>
    GROUP               GROUP_X_USER         USER
    1 - GROUP A             1 - 2            1 - MARIO
    2 - GROUP B             1 - 3            2 - JOSE
    3 - GROUP C             2 - 2            3 - MARIA
    </tt>
    That means: JOSE can access groups A and B. MARIA, just group A. MARIO does not
    have a implicit realation, so he can access all groups (A,B and C).
    Clear?
    So... I want to create a sql query that return the groups a given user can
    access. If in my where clause i use "WHERE USER_ID = 2", it should return 2
    lines: GROUP A and GROUP B.
    For users that has a impliciti relation at GROUP_X_USER is a peace of cake query.
    SELECT GROUP.NAME FROM GROUP, GROUP_X_USER, USER
    WHERE GROUP.GROUP_ID = GROUP_X_USER.GROUP_ID
    AND GROUP_X_USER.USER_ID = 2;But, this query does not work for user MARIO.
    Currently, I´m doing this:
    SELECT count(*) INTO wcount FROM GROUP_X_USER WHERE USER_ID = 1;
    if wcount = 0 then
        SELECT GROUP.NAME FROM GROUP;
    else
        SELECT GROUP.NAME FROM GROUP, GROUP_X_USER, USER
         WHERE GROUP.GROUP_ID = GROUP_X_USER.GROUP_ID
           AND GROUP_X_USER.USER_ID = 2;
    end if;
    Can I do this with just one query, whithout need do a count and a "if"?
    PS: My query is actually more complex than this, has 5 tables and a lot of "conditions".
    I made this example just to explain what I need. The goal is to have just one query
    to mantein, because, today, if it needs to change, I need to do it two times.
    Edited by: mcardia on 30/03/2010 12:15
    Edited by: mcardia on 30/03/2010 12:16

    Clear?Sorry, but
    No,since:
    1) you forgot to mention your database version (the result of select * from v$version; )
    2) you've posted unformatted code, which you can (and should) easily adjust by adding the tag before and after your examples.
        see: http://forums.oracle.com/forums/help.jspa for more explanation regarding using tags (scroll a bit down)
        we have no clue regarding columns and/or datatypes you're using now.
    3) please try to put up a small but concisive testcase, using CREATE TABLE and INSERT INTO statements and the results you want from
        that.
    Can I do this with just one query, whithout need do a count and a "if"?
    It probably can be done, but you'd need to be more clear and specific first regarding the already mentioned points.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • CR 4 Ent, Xcelsius and WebI - one query and two different results

    Dear Sirs,
    I'm using BO 4.0 platform and 3 tools: Crystal Reports for Enterprise, WebI and Dashboard Design (Xcelsius).
    I have one question, because in my opinion in this solution is one inconsistency.
    I have one table in SQL Server (like below):
    IDRec (autoinc)  | Col1 (varchar)   | Col2 (int)
    1      A    1
    2      A    1
    3      B    2
    4      B    2
    I have one universe with ONLY 3 dimensions (IDRec, Col1, Col2). I haven't any measures.
    And:
    1. Using CR 4 Ent and I create report using 3 dimensions (IDRec, Col1, Col2).
    I make sure, that I selected option: "Retrieve duplicate rows"
    If I have 3 columns in details I have 4 records (4 rows) in my report, when I have 2 columns (Col1 Col2) I have only 2 records (2 rows) in report (Page view).
    So universe (or something like this) use option DISTICT (I think).
    2. When I use WebI (14.0.2) I have the same situation.
    3. When I use Dashboard Desigm (Xcelsius 2011) I have 4 rows !!!  ALWAYS - it doesn't matter I selected "Retrieve duplicate rows" or not  !!!
    When I look to "View script" window, I not see DISTINCT clause.
    Am I doing something wrong?
    I can change the settings so as to be able to see duplicate records?
    It's very important for some calculation, especially in Crystal Reports (for Enterprise).

    Hi,
      Thanks for the response...But the result is deviating from the expected..
           expected is
         if we have first query returns              second query returns
                  1                                                     4
                  2                                                     5
                  3                                                     6
         these two queries result should be in one table , with first query result in first column and second query result in second column.
       The two queries fetching data from same table(category table as in my post) with different search criteria( in where clause).......Regards,
    Rakesh.

  • I am trying to make one query

    Hello,
    can I make these two queries as one?
               select cv_id,to_char(rDate,'Month dd, yyyy') from jobResponses
               where job_id=28 and responseStatus=0  order by rDate desc
                   select
                   c.name, nationality, gender, dob, cvName 
                   from users a, cvProperties b, cvDetails c, countries d
                   where a.user_id=b.user_id and b.cv_id=c.cv_id and a.country_id=d.country_id
                   and a.userType not like '2' and isEdited=0 order by cvDate desc;My tables:
    SQL> desc jobResponses
    Name                                      Null?    Type
    JR_ID                                     NOT NULL NUMBER(14)
    JOB_ID                                             NUMBER(14)
    CV_ID                                              NUMBER(14)
    RDATE                                              TIMESTAMP(0)
    CSDATE                                             TIMESTAMP(0)
    RESPONSESTATUS                                     NUMBER(5)
    SQL> desc users
    Name                                      Null?    Type
    USER_ID                                   NOT NULL NUMBER(14)
    AGREE_ID                                           NUMBER(14)
    COUNTRY_ID                                         NUMBER(14)
    REGISTRATIONDATE                                   TIMESTAMP(0)
    USERTYPE                                           NUMBER(2)
    STATUS                                             NUMBER(2)
    NAME                                               VARCHAR2(36)
    LOGIN                                              VARCHAR2(110)
    PASSWORD                                           VARCHAR2(15)
    FOLDERID                                           NUMBER(14)
    FOLDERCREATIONDATE                                 DATE
    SQL> desc cvProperties
    Name                                      Null?    Type
    CV_ID                                     NOT NULL NUMBER(14)
    USER_ID                                            NUMBER(14)
    CAT_ID                                             NUMBER(14)
    EMPLOYERORAGENT_ID                                 NUMBER(14)
    STAFF_ID                                           NUMBER(14)
    CVDATE                                             TIMESTAMP(0)
    CVNAME                                             VARCHAR2(230)
    STATUS                                             NUMBER(3)
    PREV_CVID                                          NUMBER(14)
    ISEDITED                                           NUMBER(2)
    CVSOURCE                                           NUMBER(2)
    SQL> desc cvDetails
    Name                                      Null?    Type
    CD_ID                                     NOT NULL NUMBER(14)
    CV_ID                                              NUMBER(14)
    NATIONALITY                                        VARCHAR2(230)
    OBJECTIVES                                         VARCHAR2(3900)
    NAME                                               VARCHAR2(230)
    FATHERNAME                                         VARCHAR2(230)
    MOTHERNAME                                         VARCHAR2(230)
    DOB                                                VARCHAR2(230)
    GENDER                                             VARCHAR2(230)
    MSTATUS                                            VARCHAR2(230)
    PASSPORTNO                                         VARCHAR2(161)
    EMAIL                                              VARCHAR2(230)
    PHONE                                              VARCHAR2(75)
    MOBILE                                             VARCHAR2(25)
    ADDRESS                                            VARCHAR2(2500)
    STATE                                              VARCHAR2(230)
    ZIPCODE                                            VARCHAR2(230)
    CITY                                               VARCHAR2(230)
    EDUCATION                                          CLOB
    EXPERIENCE                                         CLOB
    SKILLS                                             CLOB
    LANGUAGES                                          VARCHAR2(1400)
    HOBBIES                                            VARCHAR2(3200)
    ACHIEVEMENTS                                       VARCHAR2(3900)
    REFERENCES                                         VARCHAR2(3900)
    SQL> desc countries
    Name                                      Null?    Type
    COUNTRY_ID                                NOT NULL NUMBER(14)
    COUNTRY                                            VARCHAR2(50)
    SQL>Thanks in anticipation

    Hello,
    SQL*Plus: Release 11.2.0.1.0 Production on Sat Mar 31 15:38:27 2012
    create table countries(
    country_id number(14) primary key,
    country varchar2(50)
    insert into countries(country_id,country) values(1,'Australia');
    insert into countries(country_id,country) values(2,'Newzealand');
    create table Users(
    user_id number(14) primary key,
    country_id number(14) constraint Users_fk1 references countries(country_id),
    userType number(2),      
    status number(2),     
    name varchar2(36),
    login varchar2(110),     /**login will be email**/
    password varchar2(15)
    insert into users values(1,2,1,1,'Test','[email protected]','testpass');
    insert into users values(2,1,1,1,'Test1','[email protected]','testpass1');
    insert into users values(3,2,3,1,'employer','[email protected]','testpass1');
    create table CvCategories(
    cat_id number(14) primary key,
    category varchar2(900));
    insert into cvCategories values(1,'Doctors');
    insert into cvCategories values(2,'Nurses');
    create table CvProperties(
    cv_id number(14) primary key,
    user_id number(14) constraint Cv_fk1 references users(user_id),
    cat_id number(14) constraint Cv_fk2 references CvCategories(cat_id),
    cvName varchar2(230),
    status number(3),
    prev_cvId number(14),
    isEdited number(2)     
    insert into cvProperties values(1,2,1,'testCV.doc',1,0,0);
    insert into cvProperties values(2,1,2,'testCVs-1.doc',1,0,0);
    create table cvDetails(
    cd_id number(14) primary key,
    cv_id number(14) constraint education_fk references CvProperties(cv_id),
    nationality varchar2(230),
    name varchar2(230),
    dob varchar2(230),
    gender varchar2(230)
    insert into cvDetails values(1,1,'Test Country','Test Name','31-Feb-2012','Female');
    insert into cvDetails values(2,2,'Test Country-1','Test Name-1','31-Feb-2012','Male');
    create table jobProperties(
    job_id number(14) primary key,
    user_id number(14) constraint jobProperties_fk2 references users(user_id),
    status number(3),
    prev_jobId number(14),
    isEdited number(2)
    insert into jobProperties values(1,3,1,0,0);
    insert into jobProperties values(2,3,1,0,0);
    insert into jobProperties values(3,3,1,0,0);
    create table JobResponses(
    jr_id number(14) primary key,
    job_id number(14) constraint JobResponses_fk1 references jobProperties(job_id),
    cv_id number(14) constraint JobResponses_fk2 references CvProperties(cv_id),
    rDate timestamp(0) default sysdate,
    responseStatus number(5)
    insert into jobResponses(jr_id,job_id,cv_id,responseStatus) values(1,1,1,0);
    insert into jobResponses(jr_id,job_id,cv_id,responseStatus) values(2,1,2,0);
    insert into jobResponses(jr_id,job_id,cv_id,responseStatus) values(3,2,1,0);Thanks again

  • One Query or Two liinked Queries

    hi experts
    i want to know what is the better in performance in the report builder is to create one single query with join 2 master and details tables
    or
    create 2 queries one for each table and link them by datalink
    thanks

    I don't think you will notice a HUGE difference in performance.
    But, I think it would be easier to have everything in one main query then control it with grouping.
    Edited by: Kurzweil4 on Sep 8, 2010 3:30 PM

  • I want to SPLIT A CLIP. That's all. Make one piece into two.

    I am looking for the equivalent of the 'Command-T' function in iMovie HD. This is one of the most commonly used actions in processing video, and apparently it doesn't exist. The 'Split Clip' command in iMovie 09 simply does not work for me. At all. EVER. I have yet to find an instance where it isn't grayed out. All I want to do is split a clip, and add a transition between the two.
    While I'm on my soap box, the revisions of iMovie since V.6 are without a doubt the most counter-intuitive, joy-sucking applications ever produced by Apple. iMovie made it FUN to edit video; these last two versions make it frustrating and cumbersome.
    To reiterate, I want to SPLIT A CLIP INTO TWO PIECES. If anyone here can provide instructions for doing so (as opposed to explaining why it is NOT possible), then kindly do so. Thank you.

    Trey, I seriously feel your pain. I'm editing a wedding project in IM '09 and it is literally taking me twice as long to complete the project than it would have in HD. You should be able to make splits in the event browsers, but that's too much like common sense for Apple. They completely mucked up the editing process by doing away with iMovie HD, which by the way is not working well in Snow Leopard.
    As for split, I suggest the same thing as above. Put the playhead where you want the split. Us shortcut key, ShiftCommandS. I had problems with it this morning, but it finally kicked in.
    I also had a problem when trying delete a selection of a clip. When I clicked delete, it deleted the selection plus the extracted audio of the entire clip from which I took the selection. Not sure what caused that.
    I have FCE installed, so maybe I’ll haul it out and try using it for my next project. IM '09 is a pain. I'm not even sure how it's more accessible to general users.

  • One query on two databases acts differently.

    Hi - this is a doozy. I'd Ask Tom but I think he's busy...
    Database-A = PRODUCTION
    Database-B = TEST
    Both databases run 9.2.0.8, the parameter files in use are the same (so all optimizer settings etc are equal). The table spaces were created equally.
    One difference is that 'A' uses an overloaded SAN and 'B' is on a different one with plenty of bandwidth - though the problem sounds to me like a database optimizer issue, anyway...
    'B' schema was created from export/import of 'A'.
    The schemas have both been analyzed the same way (and both do each night).
    The problem is here that on 'B' the query uses the PK index on one of the tables whereas on 'A' the same query does not use the PK index.
    Note: There are slightly fewer rows in 'B' as 'A' is prod and getting updated.
    Already ruled out:
    optimizer_index_cost_adj: this is set to 100 on both databases and dropping it to 50, 10, 5 and 1 on 'A' does not make the optimizer favour the index.
    Stored outlines may not be an option for this query as we cannot alter the application code and the query changes....
    Any ideas where should I look next?
    Ta!

    Thanks to both the above comments.
    I did think about the data clustering but I kept
    coming back to why the optimizer on 'A' said "I want
    a full table scan" and 'B' says, "oh hey, there's an
    index, I'll use that".This has nothing to do with clustering data.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1069.htm#i1578369 - look for 'Clustering Factor'
    Also see Note:39836.1
    IN a nutshell - it tells the system how bad an index could be when considering the organization of the table. A table (not index) reorg could easily change the clustering factor, give the same index for the same table with exactly the same data (but different row order) a completely different value.

  • Need to make one window not two

    display dialog "Username" default answer ""
    set the target_username to the text returned of the result
    display dialog "Password" default answer "" with hidden answer
    set the pass to the text returned of the result
    when i use this i get two differnt windows one asking for the username and then one for the password after the username has been entered
    is there a way to make them appear on the same window??
    ps i having it run a sudo command at login
    do shell script "sudo blah blah /" user name target_username password pass with administrator privileges

    You can add icons to both alerts and dialogs. Your picture looks like a dialog with a caution icon:
    display dialog "some text" with icon caution
    You can use other icons with a dialog - from Standard Additions:
    display dialog
        string -- the text to display in the dialog box
        [default answer string] -- the default editable text
        [hidden answer boolean] -- Should editable text be displayed as bullets? (default is false)
        [buttons list of string] -- a list of up to three button names
        [default button number | string] -- the name or number of the default button
        [cancel button number | string] -- the name or number of the cancel button
        [with title string] -- the dialog window title
        [with icon number | string] -- the resource name or ID of the icon to display…
        [with icon stop / note / caution] -- …or one of these system icons…
        [with icon file] -- …or an alias or file reference to a ‘.icns’ file
        [giving up after integer] -- number of seconds to wait before automatically dismissing the dialog

  • How do I make one song into two separate songs?

    I have a song on my iTunes that I want to to split into two different songs, each with different names, and that can be played right after each other in the album. Is there an easy way to split up this song into two different parts, and if so, how? Thanks!

    ccreatvwhit wrote:
    How do I fade one song into another after only 1 minute or so of playing?
    That is a common capability of DJ programs, but cannot be done with iTunes.

  • Make one process of two

    Hi
    I have two different BPEL processes. Both processes are calling two different WS and both are Sync processes.
    Now i want to combine both processes into one. How do i do that? currently i have created a skeleton with a Scope activity and Flow activity in it which has my two processes. Is it the right way?
    Thanks
    Deepak

    If the output from one process is not dependent on other you can use flow.
    You need to take care of error/fault handling and may need compensate.
    thx
    rvr

  • Can we make one query to get same results from 3 tables

    CREATE TABLE TABLE1 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE2 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE3 (NODEID VARCHAR2(4));
    INSERT INTO TABLE1 VALUE('1004');
    INSERT INTO TABLE1 VALUE('1004');
    INSERT INTO TABLE1 VALUE('1002');
    INSERT INTO TABLE1 VALUE('1002');
    INSERT INTO TABLE1 VALUE('1001');
    INSERT INTO TABLE1 VALUE('1001');
    INSERT INTO TABLE1 VALUE('1006');
    INSERT INTO TABLE1 VALUE('1006');
    INSERT INTO TABLE1 VALUE('1005');
    INSERT INTO TABLE1 VALUE('1005');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1001');
    INSERT INTO TABLE3 VALUE('1001');
    INSERT INTO TABLE3 VALUE('1006');
    INSERT INTO TABLE3 VALUE('1006');
    INSERT INTO TABLE3 VALUE('1005');
    INSERT INTO TABLE3 VALUE('1005');
    INSERT INTO TABLE3 VALUE('1004');
    INSERT INTO TABLE3 VALUE('1004');
    INSERT INTO TABLE3 VALUE('1004');
    INSERT INTO TABLE3 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1002');
    Select count(*), count(distinct nodeid)
    from table1, table2,table3
    where table1.nodeid=table2.nodeid and table1.nodeid=table3.nodeid;
    Select count(*), count(distinct nodeid)
    from table1, table3
    where table1.nodeid=table2.nodeid;
    Select count(*), count(distinct nodeid)
    from table2, table3
    where table2.nodeid=table3.nodeid;

    Aside from your insert statements not working... (should be as follows)...
    DROP TABLE TABLE1;
    DROP TABLE TABLE2;
    DROP TABLE TABLE3;
    CREATE TABLE TABLE1 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE2 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE3 (NODEID VARCHAR2(4));
    INSERT INTO TABLE1 VALUES('1004');
    INSERT INTO TABLE1 VALUES('1004');
    INSERT INTO TABLE1 VALUES('1002');
    INSERT INTO TABLE1 VALUES('1002');
    INSERT INTO TABLE1 VALUES('1001');
    INSERT INTO TABLE1 VALUES('1001');
    INSERT INTO TABLE1 VALUES('1006');
    INSERT INTO TABLE1 VALUES('1006');
    INSERT INTO TABLE1 VALUES('1005');
    INSERT INTO TABLE1 VALUES('1005');
    INSERT INTO TABLE2 VALUES('1004');
    INSERT INTO TABLE2 VALUES('1004');
    INSERT INTO TABLE2 VALUES('1004');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1001');
    INSERT INTO TABLE3 VALUES('1001');
    INSERT INTO TABLE3 VALUES('1006');
    INSERT INTO TABLE3 VALUES('1006');
    INSERT INTO TABLE3 VALUES('1005');
    INSERT INTO TABLE3 VALUES('1005');
    INSERT INTO TABLE3 VALUES('1004');
    INSERT INTO TABLE3 VALUES('1004');
    INSERT INTO TABLE3 VALUES('1004');
    INSERT INTO TABLE3 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1002');and you're queries not working...
    SQL> Select count(*), count(distinct nodeid)
      2  from table1, table2,table3
      3  where table1.nodeid=table2.nodeid and table1.nodeid=table3.nodeid;
    Select count(*), count(distinct nodeid)
    ERROR at line 1:
    ORA-00918: column ambiguously definedI'm guessing you want:
    SQL> Select count(*), count(distinct table1.nodeid)
      2  from table1, table2,table3
      3  where table1.nodeid=table2.nodeid and table1.nodeid=table3.nodeid;
      COUNT(*) COUNT(DISTINCTTABLE1.NODEID)
            50                            2You haven't explained to us what database version you are using or what you want the output to look like when these 3 queries are combined.
    Please read: {message:id=9360002} and learn to post a good question, and use {noformat}{noformat} tags to show your code/data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Passing two queries

    Is there anyway to pass two queries and display their results
    in one report?
    Two queries are not related.
    Thanks.
    Sylvia

    Hi Sylvia,
    You can use the Advanced Query in CF Report builder to do
    this.
    E.g.
    <!--- STEP 1 --->
    <!---Create query object --->
    <cfset myQry = QueryNew("student, last_semester_score,
    this_semester_score","varchar, decimal, decimal")>
    <!--- Query your students database --->
    <cfquery name="qGetStudents" datasource="yourDSN">
    select student_id, student_name
    from tbl_student
    order by student_name
    </cfquery>
    <!--- Loop through recordset --->
    <cfloop query="qGetStudents">
    <!--- Get last semester's score --->
    <cfquery name="qLastSemester" datasource="yourDSN">
    select score
    from scores_table
    where student_id = #qGetStudents.student_id#
    and semester = 'Spring'
    </cfquery>
    <cfset last_semester_score =
    iif(qLastSemester.recordcount eq 0,0,DE(iif(qLastSemester.score eq
    "",0,qLastSemester.score)))>
    <!--- Get this semester's score --->
    <cfquery name="qThisSemester" datasource="yourDSN">
    select score
    from scores_table
    where student_id = #qGetStudents.student_id#
    and semester = 'Fall'
    </cfquery>
    <cfset this_semester_score =
    iif(qThisSemester.recordcount eq 0,0,DE(iif(qThisSemester.score eq
    "",0,qThisSemester.score)))>
    <!--- Populate query object --->
    <cfset numrow = QueryAddRow(myQry,1)>
    <cfset tmp =
    QuerySetCell(myQry,"student",qGetStudents.student_name)>
    <cfset tmp =
    QuerySetCell(myQry,"last_semester_score",variables.last_semester_score)>
    <cfset tmp =
    QuerySetCell(myQry,"this_semester_score",variables.this_semester_score)>
    </cfloop>
    <!--- STEP 2 --->
    Change CFReportDataQuery to myQry in the text field labelled
    "Variable containing query object"
    <!--- STEP 3 --->
    Create query fields manually (student:String,
    last_semester_score:Big Decimal, this_semester_score: Big Decimal)
    <!--- STEP 4 --->
    Drag your query fields to the Detail Band.
    Hope this helps.
    Regards,
    Yogesh

  • How to combine 2 macbook pro together to make one powerful computer?

    Hello everyone my question might sound silly or stupid, but I heard that the following is possbile....
    I have a 2 year old MacBook Pro with Tiger and 2 days old MacBook Pro with Leopard on it. However, i've heard from many people that it is possible to combine the power of two MacBook Pro together to make one of the two acquire the qualities of the other computer but I don't know how to quite make it....
    First of all, is it possible ?
    Second, if so, TELL ME HOW PLEASE
    Thank you for your answers !

    Vincent,
    The technology that does this is called "Xgrid." It requires first a fast network; wireless wouldn't be ideal. Xgrid must be enabled on all computers, with one set up as a controller. The controller can then send a portion of certain processing tasks to the other machines, when supporting applications are being used.
    Xgrid can be used, for example, for transcoding video. It can be used for complex modeling in some scientific applications. It cannot be used to increase performance in a video game.
    Scott

  • Query works as two queries, but not as one

    I am beating my head against the wall trying to figure out why a query will not return, yet when I break it up into two queries, they both return successfully.
    There is a text index on the text_a field.
    This is my query:
    select distinct /*+ */ table_c.rec_id
    from table_d, table_n, table_c
    where ( ((create_date >='2006-03-16T00:00:00Z')
    and (misc_field='abcd')
    and (contains( text_a,'ABC or DEF or GHI or JKL or MNP') > 0 ))
    /* and (rownum <=2000) */)
    and table_c.rec_id = table_d.rec_id
    and table_c.create_date = table_d.create_date
    and table_c.rec_id = table_n.rec_id
    and table_c.create_date = table_n.create_date
    This query will not return data. I get an ora-1555 every time I let it run. The longest I let it run before getting the 1555 error was 1 hr and 50 min.
    Tests suspecting a text data problem:
    Now, here's what's puzzling. The query will run if 'JKL' is taken out. So, I thought this value may be the problem, so I ran the query with just the 'JKL' value in the "contains" clause and it did not return a value.
    Tests suspecting a date problem:
    Now, even more strange: When I ran the query (with all 5 conditions for misc_field) and looked from 2006-03-17T00:00:00Z, it returned records in less than 5 minutes. Then I queries just the 16th (create_date>='2006-03-16T00:00:00Z' and create_date < '2006-03-17T00:00:00Z' and it returned rows in less than 1 minute. So, I looked at the tokens for those dates, and there are values for all of them for each of the dates from the 16th to the present (the 21st). However, when I put them together in the query above, the query just seems to hang.
    The total number of rows that should be returned is around 650 (adding the two results that worked).
    Any suggestions? The indexes are valid, syncing is up-to-date, optimizing has no errors,a nd there are token_counts for the tokens in the $I table for the text_a field.
    This problem has crossed into a second day and the same value of the 16th (as in the query above) is still used and still does not return rows. What else should I be looking at?
    In advance, thanks for any suggestions/assistance.
    - Jenny

    I believe the 1555 error is an obscure response to (i.e. a result of) another problem.
    The create_date column is a date datatype. The NLS format matches at the session, instance and database level (nls_session_parameters, and instance, and database). The NLS_DATE_FORMAT is set to YYYY-MM-DD"T"HH24:MI:SS"Z" in each of those views. Would this still cause a potential problem?
    I neglected to say that we are on version 9.2.0.7 (both the data dictionary and the binaries).
    The response from raford suggests that the optimizer is causing the text index to be called in "functional lookup" mode. I tried testing it, forcing it to use an index. The query ran in 3.5 minutes. Then I tested the original query and received the same results. After checking with the other DBAs, one of them was updating statistics on partitions for previous days' data. The statistics were only being run on current data partitions for the current day, but apparently the method that the application uses to "update" data (which could be for previous days) is to delete it and then insert it. I am suspecting that this is the root cause of all our evil! We are currently working with the developers to get this design changed. In the meantime, I REALLY appreciate all the help/suggestions. If we see the problem occur again, we will add the hint to test and verify whether or not that is the cause. I suspect it will be. Thank you raford.
    Darn that optimizer!!!! ;-)
    Oh, just a hint: Using set autotrace traceonly explain will NOT show that each of the text index partitions is being scanned. This was what we were using for our explain plans. But, when another query, with a similar problem, was finally run, we used EM and the "Long Ops" tab to finally see that each partition was being scanned for the token, whether it needed it or not. I think I'll go back to Tom Kyte's website and look for that article on the set autotrace traceonly explain not giving a totally accurate explain plan.
    Thanks again.
    - Jenny

  • Two queries in one report?

    I have Three tables like
    Device_table columns are
    d_id, d_name, date
    Software_table
    sw_id, software, version, serial_no, sw_type, d_id(foreign_key)
    hardware_table
    hw_id, hardware, specification, d_id(foriegn_key)
    now in reports i want to attach both hardware and software, I have made two quires like
    SELECT d.d_name, sw.software, sw.version, sw.sw_type from
    device_table d, software_table sw
    where d.d_id = sw.d_id
    and second query is
    SELECT d.d_name, hw.hardware, hw.specification
    from device_table d, hardware_table hw
    where d.d_id = hw.d_id
    Now my problem is that how can I add both queries in one report so that i can get a list of software and hardware attached to one device.
    Regards
    Maz

    I want to see the report as follow.
    d_name: CPU-1
    date: -----------
    Software installed:
    sw_id, software, version, serial_no, sw_type
    (list of softwares attached, can be more then one)
    Hardware attached:
    hw_id, hardware, specification (same like software list, it will contain hardware list attached to specific device),
    Please if you can help me that how will i make a query for this.
    Thanks and Regards
    Maz

Maybe you are looking for