Counting Occurences over multiple columns

I have searched the forums and found how to calculate the number of occurrences of a word in a single column.
I am working on a sales project and I need to calculate the number of occurrences for a specific sales agent in multiple columns. Then a total of the sales next to the occurrences
Column 1 will be the sales agent for a home buyer.
Column 2 will be the sales agent for a home seller.
I need to find out how many times a specific agent represents both buyers and sellers.
Then I need a total of all the sales for each of the agents.
I have very large tables with multiple categories for each sale.
Yvan you seem to be the guru.
Please help.
All the best,
Will

Will,
Jerry has given you a good solution in general terms but there are some ambiguities in your question.
For example, your question suggests there is transaction amount column, as one might expect, but did not specify if these amounts are listed in separate buyer/seller columns. The solution below assumes they are in a single column.
An auxiliary column (hidden) was added to the Data Table to determine whether or not an agent represented both buyer and seller. The agent's name appears in this column if he/she did, and the formula is:
=IF(OR(Sell Agt="",Buy Agt=""),"",Sell Agt)
The Summary table raises the question of whether the agent's amount is doubled when he/she represents both buyer and seller. Here again, an assumption was made, namely, that it does not. If this is incorrect, the last segment (after the "-" sign) of the formula below can be dropped:
=IF(A="","",SUMIF(Sales Data :: Sell Agt, A, Sales Data :: Trans Amt)+SUMIF(Sales Data :: Buy Agt, A, Sales Data :: Trans Amt)-SUMIF(Sales Data :: 'Buyer & Seller Rep', A, Sales Data :: Trans Amt))
And finally, the number of times an agent represented both buyer and seller:
=IF(COUNTIF(Sales Data :: 'Buyer & Seller Rep', A)=0,"",COUNTIF(Sales Data :: 'Buyer & Seller Rep', A))
I hope this represents your situation and that it answers your questions.
pw

Similar Messages

  • Master-detail list - how to spread over multiple columns

    I am using the master-detail functionality to create a image viewer.
    I have a long list of master thumbnails, and rather than having them go down the page in one column, I would like to make them spread over 2 or 3 columns before the detail column. 
    (example of format I am trying to achieve - http://www.franbainbridgephotography.com.au/gallery.html (I dont mind whether master thumbnails are on right or left of detail photo))
    You can see my problem on http://www.wcwra.com/webpages/images.php
    Is this possible with the master-detail functionality?
    Thank you!

    The brilliant David Powers has fixed this for me on the main forum (vw2ureg was v close).  David's answer is :
    There is no way of making a single dataset repeat in multiple columns, because it's simply one element being repeated over and over.
    However, with a little out of the box thinking, you can do it quite easily with thumbnails. Instead of putting the master column repeat region in a block level element, use an inline element, <span>. Images are treated by browsers as inline elements, so this should work just fine. Change the following code from this:
    <div spry:region="dsPhotos" class="MasterContainer">
        <div class="MasterColumn" spry:repeat="dsPhotos" spry:setrow="dsPhotos"
        spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Caption}</div>
    </div>
    to this:
    <div spry:region="dsPhotos" class="MasterContainer">
        <span class="MasterColumn" spry:repeat="dsPhotos" spry:setrow="dsPhotos"
        spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Caption}</span>
    </div>
    In your CSS, set the width of the MasterColumn class to the width of your thumbnails, and the width of MasterContainer so that it's wide enough to accommodate two or more thumbnails. The thumbnails will flow into the column two or three abreast.

  • COUNT(DISTINCT) on multiple columns?

    Is there an easier way of doing a COUNT(DISTINCT...) on multiple items than converting them to strings and concatenating them?
    i.e. if I have a table with column string1 as VARCHAR2(1000), number2 as NUMBER, and date3 as DATE, and I want a count on how many distinct combinations of the three exist, is there a better way than:
    SELECT COUNT(DISTINCT string1 || TO_CHAR(number2) || TO_CHAR(date3, 'YYYYMMDD'))-- Don

    Hi,
    Why not a group by?
    SQL> ed
    Wrote file afiedt.buf
      1  with t as
      2  (
      3  select 'string1' string1, 1 number1, to_date('10-NOV-2009','DD-MON-YYYY') date1 from dual
      4  union all select 'string2',1,to_date('10-NOV-2009','DD-MON-YYYY') from dual
      5  union all select 'string1',1,to_date('11-NOV-2009','DD-MON-YYYY') from dual
      6  union all select 'string1',2,to_date('11-NOV-2009','DD-MON-YYYY') from dual
      7  union all select 'string2',1,to_date('10-NOV-2009','DD-MON-YYYY') from dual
      8  )
      9  select string1, number1, date1 from t
    10* group by string1, number1, date1
    SQL> /
    STRING1    NUMBER1 DATE1
    string1          1 11-NOV-09
    string2          1 10-NOV-09
    string1          1 10-NOV-09
    string1          2 11-NOV-09
    SQL> ed
    Wrote file afiedt.buf
      1  with t as
      2  (
      3  select 'string1' string1, 1 number1, to_date('10-NOV-2009','DD-MON-YYYY') date1 from dual
      4  union all select 'string2',1,to_date('10-NOV-2009','DD-MON-YYYY') from dual
      5  union all select 'string1',1,to_date('11-NOV-2009','DD-MON-YYYY') from dual
      6  union all select 'string1',2,to_date('11-NOV-2009','DD-MON-YYYY') from dual
      7  union all select 'string2',1,to_date('10-NOV-2009','DD-MON-YYYY') from dual
      8  )
      9  select string1, number1, date1 from t
    10  group by string1, number1, date1
    11* having count(*) > 1
    SQL> /
    STRING1    NUMBER1 DATE1
    string2          1 10-NOV-09-Arun

  • Expanding row over multiple columns

    Hi,
    I have a jtable with 5 columns.
    The table holds sales data,
    date,
    time,
    item,
    size,
    type
    The columns have setMinWidth and setPreferredWidth invoked on them for formatting.
    However I have a certain products that only has the date, time and item NOT the size and type.
    The item name is very long and I want it to expand into the type and size column.
    Whats the best way to do this?
    thanks
    Bobby

    PhHein wrote:
    So you consider 'I want a blue button' and 'I want a red button' as different topics too? It's a about cell merging in a JTable.Well maybe you've got a solution in mind that solves both, but I don't. I for one would realize a rowspan by 'merging' the value within the table model, and using the renderer to make for the visual appeal. This approach would not work for colspan, obviously, unless you're using a rather dirty hack with the renderer invoking itself. So as I see it the more appropriate question from your side would be ''So you consider 'I want a blue button' and 'I want a round button' as different topics too?', to which I'd say yes.

  • How to get a distinct count of multiple columns

    I've done this before and I'll be darned why I can't recall this.
    Table with 3 columns with the primary key defined in column a.
    Row a b c
    num.
    1 020 how abc
    2 030 why def
    3 010 not ghi
    4 040 how abc
    5 050 yes def
    6 060 why def
    So what I want is a count of the unique values for columns b and c as if b and c were actually one field.
    So the result of the query would be:
    Count = 4 unique rows.
    Hopefully I'm making some sort of sense. It's a bit much to ask about the number of occurrences of each duplicate value, I'm sure just getting count of the unique rows of the non-indexed rows will be sufficient. Since the query is meant to be universal for multiple columns of numeric and alphanumeric data and can be expanded for multiple columns, I am simply trying to get a basic skeleton that works for an "on the fly" analysis.

    Thanks to all of you. I had the idea and just couldn't nail it down. You did it.
    All of you understood what I poorly communicated. My apologies for the lack of prep with a table, I was running patches on the system and couldn't dare interrupt it on my laptop and starting Oracle 11 while Micro$lop was patching all sorts of evil code. This is something I'm setting up on my own time so it's a work I'm going to try to be proud of. So there will be plenty of instrumentation and debugging code for timing.
    I'd thought of concatenating columns and was worried it wouldn't backport to older Oracle versions (work goes back to 8.1.7) with nulls and other goofy things like long raw fields or lob/clobs plus the other DBs that are at various sites. What I'm trying to do is improve on a crappy data analysis tool SAP provides to use with reporting unique columns. (Basis people could recognize this as DB05). I tried dragging out the SQL that their ABAP/4 language generates from an SQL trace but it was unusable and often dies on internal storage which on most sites is about 4GB per process. Needless to say, the program is wasteful and I'm trying to keep the work on the DB where it belongs and discourage cowboys from doing this in the DB on the fly and at the same time make it simpler for junior members to use while having a semblance of an audit trail.
    What I'm trying to do is work out a tool that checks all the crappy secondary indexes that were created by folks who seem to think in ways that are from an alien species not yet speculated about even with the strongest psychedelics. One of them actually decreases performance by a minimum factor of 5. It's not much when it's 5 seconds but when the response time averages about 3 hours beforehand, you can imagine what it was like afterward. In this particular case, the "logic" was that the index needed to be defined by the order of the fields of the select clause. Some myths never die. So it's not easy to work out which ones haven't been used in a long time, so it's down to finding which of the custom ones are actually bad in terms of selectivity. Some of these may have made a little bit of sense when the system was started up, now that some of these have millions of rows instead of a few thousand, thaw tend to expose the flaws in design.
    I'm also trying to make this work on multiple DBs such as DB2, MaxDB and (sob) SQL Squealer. The idea is to write this in ABAP code as a utility without the overhead of internal tables in ABAP as some of these tables are many millions of rows and I have to account for the size in memory. (ABAP field sizes in internal memory are generally much larger than the actual DB lengths. so every bit helps!) So I'm trying to create actual SQL on the fly and use it internally without going through the SAP DB interface which limits the type of SQL functions used and all the overhead. It's intended to grab a secondary index and if there are more than 2 fields defined, work it backwards to show unique values for all columns, all columns - 1, all columns - 2 and so on back to the initial column in the index.
    Why does this seem important? On Oracle I can generate histograms but those can often screw up SAP. On other DBs, the indexing cardinality is much more important, particularly with DB optimizers that make some odd decisions. So I need evidence I can push to folks who will only understand if there's a plain and simple analysis that explains it (almost) in crayon.
    I'm testing null values next (which worked!) but these suggestions all seem to follow the same idea which won't work in ABAP without some serious memory issues. So I'm down to this type of coding:
    exec sql.
    <dynamically generated true SQL>
    end-exec.
    rather than using ABAP with their concept of "open SQL" and the DB interface with all the overhead.
    RB's suggestion of the UNION ALL wasn't quite what I was looking for BUT it made me think that this would be a nice enhancement for evaluations!
    So the candidates that seem to work for what I wanted are as follows:
    SQL> SELECT COUNT (MIN (0)) AS distinct_col3_col4_cnt
    2 from rb group by b, c;
    DISTINCT_COL3_COL4_CNT
    7
    select count(distinct(b || c)) num_rows from rb;
    So thanks also to Frank, APNL and Nimesh for their examples. Now the fun starts as I spec out the processing.

  • How do you count the multiple columns of a field in a table

    How do you count the multiple columns of a field in a table

    Hi,
    4396bf34-e890-4202-a6b0-4e08c9ff0e89 wrote:
    How do you count the multiple columns of a field in a table
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002
    "Field" isn't a standard database term.  Some people say "field" when they mean "column", but I don't think that's what you mean ("How do you count the multiple columns of a column ..").  Do you want to know how many times a column is used (as opposed to NULL), or the number of different values in a column?  You really need to show what you want.

  • Top N Analysis with multiple columns

    Hi
    I am using Oracle 9i. I do have a table which contains datewise promotional material types for an organisation.
    The structure is as follows:
    CREATE TABLE TEST
    (CDATE DATE,
    BROCHURE VARCHAR2(1),
    WEBSITE VARCHAR2(1),
    DIRECT_MAIL VARCHAR2(1),
    PRESS_RELEASE VARCHAR2(1),
    JOURNAL_AD VARCHAR2(1)
    and the sample data is as follows:
    CDate          Brochure     Website     Direct_Mail     Press_Release Journal_Ad
    01/04/1996     Y Y Y N N
    02/04/1996     Y Y N N N
    23/06/1996     Y N Y Y N
    13/09/1996     Y Y N N N
    01/04/1997     Y Y N N N
    02/04/1997     Y Y Y N Y
    23/06/1997     N Y N N Y
    13/09/1997     Y Y N N N
    01/04/1998     Y Y Y N N
    02/04/1998     Y N N Y N
    23/06/1998     N Y N N Y
    13/09/1998     Y Y N N Y
    01/04/1999     Y Y Y N Y
    02/04/1999     Y N N Y N
    23/06/1999     N Y N N N
    13/09/1999     Y Y Y N N
    I want to have year wise top 4 promotional types in terms of count of 'Y' only. The result should be like as follows:
    YEAR:1996
    TYPE     COUNT
    BROCHURE 4
    WEBSITE 3
    DIRECT_MAIL 2
    PRESS_RELEASE 1
    JOURNAL_AD 0
    YEAR:1997
    TYPE     COUNT
    WEBSITE 4
    BROCHURE 3
    JOURNAL_AD 2
    DIRECT_MAIL 1
    PRESS_RELEASE 1
    Please suggest a solution for the same. I am not able to sort it for multiple columns.
    Regards
    MS

    One of the questions that must be asked when you have a requirement to only show the top N ranked items in a list, is "what about a tie in the ranking?".
    Oracle has two ranking functions that allow you to deal with either requirement - RANK and DENSE_RANK. Both operate as either analytic or aggregate functions, so either will work for your requirements. The previous posting by Miguel demonstrated how to decode your Y/N flags and pivot the data.
    In this example, I've taken the liberty of adding some data to year 2000 that will show the difference between RANK and DENSE_RANK as well as how to use them to filter your results.
    First, here's the decoded/pivoted data:
    SQL>WITH test AS
      2  (         SELECT TO_DATE('01/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      3  UNION ALL SELECT TO_DATE('02/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      4  UNION ALL SELECT TO_DATE('23/06/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      5  UNION ALL SELECT TO_DATE('13/09/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      6  UNION ALL SELECT TO_DATE('01/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      7  UNION ALL SELECT TO_DATE('02/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
      8  UNION ALL SELECT TO_DATE('23/06/1997','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
      9  UNION ALL SELECT TO_DATE('13/09/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    10  UNION ALL SELECT TO_DATE('01/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    11  UNION ALL SELECT TO_DATE('02/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    12  UNION ALL SELECT TO_DATE('23/06/1998','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    13  UNION ALL SELECT TO_DATE('13/09/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    14  UNION ALL SELECT TO_DATE('01/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    15  UNION ALL SELECT TO_DATE('02/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    16  UNION ALL SELECT TO_DATE('23/06/1999','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    17  UNION ALL SELECT TO_DATE('13/09/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    18  UNION ALL SELECT TO_DATE('01/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    19  UNION ALL SELECT TO_DATE('02/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    20  UNION ALL SELECT TO_DATE('23/06/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    21  UNION ALL SELECT TO_DATE('13/09/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    22  )
    23  SELECT cyear
    24        ,ctype
    25        ,RANK()       OVER (PARTITION BY cyear ORDER BY num_media DESC) ranking
    26        ,DENSE_RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) dense_ranking
    27  FROM (SELECT TRUNC(CDATE,'Y') CYEAR
    28             ,'BROCHURE' CTYPE, SUM(DECODE(BROCHURE, 'Y', 1, 0)) NUM_MEDIA
    29        FROM test
    30        GROUP BY TRUNC(CDATE,'Y')
    31        UNION ALL
    32        SELECT TRUNC(CDATE,'Y') CYEAR
    33             ,'WEBSITE' CTYPE, SUM(DECODE(WEBSITE, 'Y', 1, 0))
    34        FROM test
    35        GROUP BY TRUNC(CDATE,'Y')
    36        UNION ALL
    37        SELECT TRUNC(CDATE,'Y') CYEAR
    38             ,'DIRECT_MAIL' CTYPE, SUM(DECODE(DIRECT_MAIL, 'Y', 1, 0))
    39        FROM test
    40        GROUP BY TRUNC(CDATE,'Y')
    41        UNION ALL
    42        SELECT TRUNC(CDATE,'Y') CYEAR
    43             ,'PRESS_RELEASE' CTYPE, SUM(DECODE(PRESS_RELEASE, 'Y', 1, 0))
    44        FROM test
    45        GROUP BY TRUNC(CDATE,'Y')
    46        UNION ALL
    47        SELECT TRUNC(CDATE,'Y') CYEAR
    48             ,'JOURNAL_AD' CTYPE, SUM(DECODE(JOURNAL_AD, 'Y', 1, 0))
    49        FROM test
    50        GROUP BY TRUNC(CDATE,'Y')
    51       )
    52* order by cyear desc, ranking
    53  /
    CYEAR                         CTYPE             RANKING DENSE_RANKING
    01-Jan-2000 00:00:00          BROCHURE                1             1
    01-Jan-2000 00:00:00          WEBSITE                 1             1
    01-Jan-2000 00:00:00          DIRECT_MAIL             3             2
    01-Jan-2000 00:00:00          PRESS_RELEASE           4             3
    01-Jan-2000 00:00:00          JOURNAL_AD              5             4
    01-Jan-1999 00:00:00          BROCHURE                1             1
    01-Jan-1999 00:00:00          WEBSITE                 1             1
    01-Jan-1999 00:00:00          DIRECT_MAIL             3             2
    01-Jan-1999 00:00:00          PRESS_RELEASE           4             3
    01-Jan-1999 00:00:00          JOURNAL_AD              4             3
    01-Jan-1998 00:00:00          BROCHURE                1             1
    01-Jan-1998 00:00:00          WEBSITE                 1             1
    01-Jan-1998 00:00:00          JOURNAL_AD              3             2
    01-Jan-1998 00:00:00          DIRECT_MAIL             4             3
    01-Jan-1998 00:00:00          PRESS_RELEASE           4             3
    01-Jan-1997 00:00:00          WEBSITE                 1             1
    01-Jan-1997 00:00:00          BROCHURE                2             2
    01-Jan-1997 00:00:00          JOURNAL_AD              3             3
    01-Jan-1997 00:00:00          DIRECT_MAIL             4             4
    01-Jan-1997 00:00:00          PRESS_RELEASE           5             5
    01-Jan-1996 00:00:00          BROCHURE                1             1
    01-Jan-1996 00:00:00          WEBSITE                 2             2
    01-Jan-1996 00:00:00          DIRECT_MAIL             3             3
    01-Jan-1996 00:00:00          PRESS_RELEASE           4             4
    01-Jan-1996 00:00:00          JOURNAL_AD              5             5You can see that in year 2000 there is a tie for first place (ranking #1). The RANK function will name the second highest count 3 (skipping the rank of 2 due to the tie), while the DENSE_RANK function will not skip a ranking.
    Now, to filter on the ranking, wrap your query in another in-line view like this - but use which ever ranking function YOUR requirements call for:
    SQL>WITH test AS
      2  (         SELECT TO_DATE('01/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      3  UNION ALL SELECT TO_DATE('02/04/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      4  UNION ALL SELECT TO_DATE('23/06/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      5  UNION ALL SELECT TO_DATE('13/09/1996','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      6  UNION ALL SELECT TO_DATE('01/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
      7  UNION ALL SELECT TO_DATE('02/04/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
      8  UNION ALL SELECT TO_DATE('23/06/1997','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
      9  UNION ALL SELECT TO_DATE('13/09/1997','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    10  UNION ALL SELECT TO_DATE('01/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    11  UNION ALL SELECT TO_DATE('02/04/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    12  UNION ALL SELECT TO_DATE('23/06/1998','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    13  UNION ALL SELECT TO_DATE('13/09/1998','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    14  UNION ALL SELECT TO_DATE('01/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    15  UNION ALL SELECT TO_DATE('02/04/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'N' AS WEBSITE, 'N' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    16  UNION ALL SELECT TO_DATE('23/06/1999','dd/mm/yyyy') AS CDATE, 'N' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    17  UNION ALL SELECT TO_DATE('13/09/1999','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    18  UNION ALL SELECT TO_DATE('01/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'Y' AS JOURNAL_AD FROM DUAL
    19  UNION ALL SELECT TO_DATE('02/04/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    20  UNION ALL SELECT TO_DATE('23/06/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'N' AS DIRECT_MAIL, 'N' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    21  UNION ALL SELECT TO_DATE('13/09/2000','dd/mm/yyyy') AS CDATE, 'Y' AS BROCHURE, 'Y' AS WEBSITE, 'Y' AS DIRECT_MAIL, 'Y' AS PRESS_RELEASE, 'N' AS JOURNAL_AD FROM DUAL
    22  )
    23  SELECT * FROM (
    24      SELECT cyear
    25            ,ctype
    26            ,RANK()       OVER (PARTITION BY cyear ORDER BY num_media DESC) ranking
    27            ,DENSE_RANK() OVER (PARTITION BY cyear ORDER BY num_media DESC) dense_ranking
    28      FROM (SELECT TRUNC(CDATE,'Y') CYEAR
    29                 ,'BROCHURE' CTYPE, SUM(DECODE(BROCHURE, 'Y', 1, 0)) NUM_MEDIA
    30            FROM test
    31            GROUP BY TRUNC(CDATE,'Y')
    32            UNION ALL
    33            SELECT TRUNC(CDATE,'Y') CYEAR
    34                 ,'WEBSITE' CTYPE, SUM(DECODE(WEBSITE, 'Y', 1, 0))
    35            FROM test
    36            GROUP BY TRUNC(CDATE,'Y')
    37            UNION ALL
    38            SELECT TRUNC(CDATE,'Y') CYEAR
    39                 ,'DIRECT_MAIL' CTYPE, SUM(DECODE(DIRECT_MAIL, 'Y', 1, 0))
    40            FROM test
    41            GROUP BY TRUNC(CDATE,'Y')
    42            UNION ALL
    43            SELECT TRUNC(CDATE,'Y') CYEAR
    44                 ,'PRESS_RELEASE' CTYPE, SUM(DECODE(PRESS_RELEASE, 'Y', 1, 0))
    45            FROM test
    46            GROUP BY TRUNC(CDATE,'Y')
    47            UNION ALL
    48            SELECT TRUNC(CDATE,'Y') CYEAR
    49                 ,'JOURNAL_AD' CTYPE, SUM(DECODE(JOURNAL_AD, 'Y', 1, 0))
    50            FROM test
    51            GROUP BY TRUNC(CDATE,'Y')
    52           )
    53      )
    54  where RANKING <= 4
    55* order by cyear desc, ranking
    56  /
    CYEAR                         CTYPE             RANKING DENSE_RANKING
    01-Jan-2000 00:00:00          WEBSITE                 1             1
    01-Jan-2000 00:00:00          BROCHURE                1             1
    01-Jan-2000 00:00:00          DIRECT_MAIL             3             2
    01-Jan-2000 00:00:00          PRESS_RELEASE           4             3
    01-Jan-1999 00:00:00          BROCHURE                1             1
    01-Jan-1999 00:00:00          WEBSITE                 1             1
    01-Jan-1999 00:00:00          DIRECT_MAIL             3             2
    01-Jan-1999 00:00:00          JOURNAL_AD              4             3
    01-Jan-1999 00:00:00          PRESS_RELEASE           4             3
    01-Jan-1998 00:00:00          BROCHURE                1             1
    01-Jan-1998 00:00:00          WEBSITE                 1             1
    01-Jan-1998 00:00:00          JOURNAL_AD              3             2
    01-Jan-1998 00:00:00          PRESS_RELEASE           4             3
    01-Jan-1998 00:00:00          DIRECT_MAIL             4             3
    01-Jan-1997 00:00:00          WEBSITE                 1             1
    01-Jan-1997 00:00:00          BROCHURE                2             2
    01-Jan-1997 00:00:00          JOURNAL_AD              3             3
    01-Jan-1997 00:00:00          DIRECT_MAIL             4             4
    01-Jan-1996 00:00:00          BROCHURE                1             1
    01-Jan-1996 00:00:00          WEBSITE                 2             2
    01-Jan-1996 00:00:00          DIRECT_MAIL             3             3
    01-Jan-1996 00:00:00          PRESS_RELEASE           4             4

  • Size of a specific table on disk? Queries over multiple (2) tablespaces?

    I am looking for a way to find out (for Oracle 9.2.0.1.0).
    How much space does each or a specific table require on disk?
    (whether with indices or without is the other question).
    And how much "payload" data is in each or a specific table?
    Another question - of my team leader - is:
    Is it possible to make queries over multiple (2) tablespaces?
    I assume - no - am I right?
    Thank you for precise answers as well as links to other threads in this forum (where I did not find it until now),
    and chapters in online documentation - or other sources.
    PS: I know SQL, PL/SQL a bit.
    We have Oracle Enterprise Manager console and SQL*Plus console.

    >
    The table size can not be found in bytes precisely, but in number of blocks of a certain size allocated for this table (index etc.).
    select segment_type,segment_name, Sum(Bytes)/1024 as kB from DBA_EXTENTS
    where tablespace_name = 'xyz' group by segment_type,segment_name;
    There are more blocks allocated for a table than space is needed by the current data amount.
    I guess, that this table was once bigger and has been emptied a bit.
    >
    A table grows in extents that get filled then with new rows. The columns
    blocks and bytes of user_tables get populated from dba_stats.
    In below example, the table rows have filled up to MB_TABLE the extents:
    SQL> select table_name,blocks*8/1024 as mb from user_tables order by 1;
    TABLE_NAME                   MB_TABLE
    CUSTOMERS            11.6015625
    SALES                 278.96875
    SQL> select segment_name,bytes/1024/1024 as mb from user_segments order by 1;
    SEGMENT_NAME                 MB_SEGMENT
    CUSTOMERS                    12
    SALES                       285If you later on delete again from the tables, that does not deallocate extents nor remove the high water mark unless you reorganize the table:
    SQL> select count(*) from customers;
      COUNT(*)
         55500
    SQL> delete from customers where rownum<25000;
    24999 rows deleted.
    SQL> commit;
    Commit complete.
    SQL> select segment_name,bytes/1024/1024 as mb from user_segments order by 1;
    SEGMENT_NAME                 MB
    CUSTOMERS                    12
    SALES                       285
    SQL> select table_name,blocks*8/1024 as mb from user_tables order by 1;
    TABLE_NAME                   MB
    CUSTOMERS            11.6015625
    SALES                 278.96875
    SQL> exec dbms_stats.gather_table_stats('ADAM','CUSTOMERS')
    PL/SQL procedure successfully completed.
    SQL> select table_name,blocks*8/1024 as mb from user_tables order by 1;
    TABLE_NAME                   MB
    CUSTOMERS            11.6015625
    SALES                 278.96875
    SQL> alter table customers enable row movement;
    Table altered.
    SQL> alter table customers shrink space;
    Table altered.
    SQL> exec dbms_stats.gather_table_stats('ADAM','CUSTOMERS')
    PL/SQL procedure successfully completed.
    SQL> select segment_name,bytes/1024/1024 as mb from user_segments order by 1;
    SEGMENT_NAME                 MB
    CUSTOMERS                6.4375
    SALES                       285
    SQL> select table_name,blocks*8/1024 as mb from user_tables order by 1;
    TABLE_NAME                   MB
    CUSTOMERS             6.2265625
    SALES                 278.96875Kind regards
    Uwe
    http://uhesse.wordpress.com

  • Result to be in multiple columns instead of one

    Hi,
    i have used the below sql :
    select parent_id, max(sys_connect_by_path(name,'^')) History
    from (select parent_id, name, row_number() over (partition by parent_id order by name) rn
    from notes )
    start with rn = 1
    connect by prior rn = rn-1
    and prior parent_id = parent_id
    group by parent_id
    order by parent_id
    this gets me the 'HISTORY' row returned in a single column. Problem is if i have 5 HISTORY notes, they all appear in same column with delimiter ^.
    Please help to modify query as to get History as multiple columns instead of 1
    Below is example of sample data returned , NOTE: history could contain any amount of rows.
    ID     HISTORY
    1     ^TT updates requested^TT updates requested^Update on TT #104836
    2     ^Call back actioned^Delivery Update^Internation Dialing ^TT Follow up (147023)
    3     ^Queried poor signal strength
    Idea case would be :
    ID     HISTORY HISTORY1 HISTORY2
    1     TT updates requested TT updates requested Update on TT #104836

    Hi,
    You might want to leave the results as one long string, but just add some spacing.
    Right now you're using
    sys_connect_by_path(name,'^')and getting output like
    1 ^TT updates requested^TT updates requested^Update on TT #104836
    2 ^Call back actioned^Delivery Update^Internation Dialing ^TT Follow up (147023)
    3 ^Queried poor signal strengthwhich is as hard to read as an OTN posting that doesn't use \ tags.  Naturally you're not going to insult your uses by asking them to read something like that.
    If you use this instead:REPLACE ( sys_connect_by_path ( RPAD (name, 32)
                   ,'^'
         , '^'
    then the output will look like this:TT updates requested          TT updates requested          Update on TT #104836
    Call back actioned          Delivery Update               Internation Dialing           TT Follow up (147023)
    Queried poor signal strength
    See this thread:
    Re: Report count and sum from many rows into many columns
    for various ways to deal with problems like this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • SELECT in SELECT returning multiple columns ?

    10.2.0.3 version.
    I am trying to tune this query
    SELECT A.EMPLID, A.EFFDT, A.ACAD_PROG,
    (SELECT A1.DESCR FROM PS_ACAD_PROG_TBL A1
    WHERE A1.INSTITUTION = 'AUAO1' AND A1.ACAD_PROG = A.ACAD_PROG AND A1.EFFDT = (SELECT MAX (EFFDT) FROM PS_ACAD_PROG_TBL WHERE INSTITUTION = A1.INSTITUTION AND ACAD_PROG = A1.ACAD_PROG),
    (SELECT A2.DESCRSHORT FROM PS_ACAD_PROG_TBL A2
    WHERE A2.INSTITUTION = 'AUAO1' AND A2.ACAD_PROG = A.ACAD_PROG AND A2.EFFDT = (SELECT MAX (EFFDT) FROM PS_ACAD_PROG_TBL WHERE INSTITUTION = A2.INSTITUTION AND ACAD_PROG = A2.ACAD_PROG),
    as you can see it reading the table PS_ACAD_PROG_TBL two time to get two cloumns DESCR (alias A1) and DESCRSHORT (alias A2) exactly with the same where condition.
    I am trying to replace it with just one select returning multiple columns like this
    SELECT A.EMPLID, A.EFFDT, A.ACAD_PROG,
    (SELECT A1.DESCR, A1.DESCRSHORT FROM PS_ACAD_PROG_TBL A1
    WHERE A1.INSTITUTION = 'AUAO1' AND A1.ACAD_PROG = A.ACAD_PROG AND A1.EFFDT = (SELECT MAX (EFFDT) FROM PS_ACAD_PROG_TBL WHERE INSTITUTION = A1.INSTITUTION AND ACAD_PROG = A1.ACAD_PROG),
    but I am getting ORA-00913: too many values.
    Please help on how to get around this. Thanks in advance.

    William,
    On similar lines I am struggling with the below query based on your suggestions.
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed Aug 5 14:17:21 2009
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> WITH arch_dup AS
      2       (SELECT   a.file_id,
      3                 a.sale_start,
      4                 a.activity_start,
      5                 a.activity_end,
      6                 a.item_code_cust,
      7                 a.division,
      8                 (SELECT MAX (DISTINCT (NVL (b.advertised, 'No')))
      9                    FROM ah_cust_gis_arch_stg b
    10                   WHERE b.file_id = a.file_id
    11                     AND NVL (b.sale_start, 'NULL') = NVL (a.sale_start, 'NULL')
    12                     AND NVL (b.activity_start, 'NULL') = NVL (a.activity_start, 'NULL')
    13                     AND NVL (b.activity_end, 'NULL') = NVL (a.activity_end, 'NULL')
    14                     AND b.item_code_cust = a.item_code_cust
    15                     AND b.division = a.division) advertised,
    16                 COUNT (*)
    17            FROM ah_cust_gis_arch_stg a
    18           WHERE a.file_id = 209
    19             AND a.status_id = 21
    20        GROUP BY a.file_id, a.sale_start, a.activity_start, a.activity_end, a.item_code_cust, a.d
    ivision
    21          HAVING COUNT (*) > 1)
    22  SELECT dup.*,
    23         (SELECT activity_id
    24            FROM (SELECT activity_id,
    25                         ROW_NUMBER () OVER (ORDER BY (activity_retail / activity_mult)) rnk
    26                    FROM ah_cust_gis_arch_stg
    27                   WHERE status_id = 21
    28                     AND NVL (sale_start, 'NULL') = NVL (dup.sale_start, 'NULL')
    29                     AND NVL (activity_start, 'NULL') = NVL (dup.activity_start, 'NULL')
    30                     AND NVL (activity_end, 'NULL') = NVL (dup.activity_end, 'NULL')
    31                     AND item_code_cust = dup.item_code_cust
    32                     AND division = dup.division
    33                     AND file_id = 209
    34                     AND UPPER (NVL (advertised, 'N')) = dup.advertised)
    35           WHERE rnk = 1) activity_id
    36    FROM arch_dup dup;
                       AND UPPER (NVL (advertised, 'N')) = dup.advertised)
    ERROR at line 34:
    ORA-00904: "DUP"."ADVERTISED": invalid identifierCan you throw some light on what to do to make the outer query columns available to inner query?
    Thanks,
    Raj.

  • How do I run a table over multiple pages?

    Hi I write TV scripts using a simple two column table which can be many rows long - how can I get Pages to automatically run the table over multiple pages whilst still allowing me to cut and paste and rearrange the script? This is simple in Word and must work in pages but I can't work out how to get it to work. I've tried looking at the Page Break feature but it won't come up from the table?
    many thanks

    At this time, There is no way to drive tables in Pages with AppleScript.
    Do your job in Numbers which allow that.
    Yvan KOENIG (from FRANCE vendredi 6 février 2009 13:54:35)

  • How do i print multiple columns on 1 page in numbers

    I think I am over thinking this but I have confused myself. I am using Numbers to create a spreadsheet of family names with their corresponding number. I would like to print multiple columns of names on one page to save paper but I can't figure how to do it. Will someone please help me???

    Hi BestMommy,
    Here is one way. Don't mess with your database. Create a new table for printing.
    Database with a Header Row (named Table 1 as an example) might look like this:
    Name
    1
    Name 1
    2
    Name 2
    3
    Name 3
    4
    Name 4
    5
    Name 5
    6
    Name 6
    7
    Name 7
    8
    Name 8
    9
    Name 9
    10
    Name 10
    11
    Name 11
    12
    Name 12
    13
    Name 13
    14
    Name 14
    15
    Name 15
    New table for printing:
    Name
    Name
    1
    Name 1
    8
    Name 8
    2
    Name 2
    9
    Name 9
    3
    Name 3
    10
    Name 10
    4
    Name 4
    11
    Name 11
    5
    Name 5
    12
    Name 12
    6
    Name 6
    13
    Name 13
    7
    Name 7
    14
    Name 14
    Formula in A2
    =Table 1::A2
    Formula in B2
    =Table 1::B2
    Formula in C2
    =Table 1::A9
    Formula in D2
    =Table 1::B9
    So it loops back from the bottom of a page to start a new column.
    I made this example small for the pics, but obviously you could have more rows and columns per page.
    Having created your table for printing, select it, Cut, add a new sheet and Paste. Print just that sheet.
    Have a look at 'More Like This' at the bottom of this page. Trying to format page to print table in two columns Jerry suggests using Pages instead of Numbers.
    Regards,
    Ian.
    Edit: Having created your table for printing, select it, Cut, add a new sheet and Paste. Print just that sheet. Ian.

  • How do I select multiple columns in a recordset

    I am very new to Dreamweaver/PHP/MYSQL
    I have created my recordset but I cant work out how I select multiple columns.
    How do I select multiple columns, I want to search for data that is spread over different columns.
    My recordset looks like this just now.
    SELECT *
    FROM names
    WHERE nameone = john
    I have 11 columns where the name john my or may not appear so how would I select all the columns. What would the recordset look like.
    As I have said I,m very new to this  and forgive me if what i have just said makes no sense.
    Thanks

    >I have 11 columns where the name john my
    >or may not appear so how would I select all
    >the columns. What would the recordset look like.
    You could try a Full-Text search (if mysql supports it) but on the surface, this sounds like a badly designed data structure. What does your database and table design look like?

  • How Can I Put Multiple Columns in a Drop-Down Menu?

    We are trying to put multiple columns in a drop-down menu, similar to what is on these web sites...
    http://www.cabelas.com/
    http://www.target.com/  (This site has the multiple columns on the Women, Home, Kitching & Dining, Toys, Electronics, and See More categories).
    If anyone has any suggestions for coding, please reply.
    Thank you.
    Wil Radcliffe

    As an <li> tag is not a block level element like a <p> or <div> tag you can store a <div> container within the <li> tag and create an element in that menu item and us the following tutorial to create multiple columns depending on the ordering:
    http://www.alistapart.com/articles/multicolumnlists
    Depending on your target browser you could also use the CSS3 column-count to define the amount of columns.  But with just a quick glance at this I would say it only works in the the later versions of Firefox, Chrome, Safari and IE9+.
    http://www.w3schools.com/cssref/css3_pr_column-count.asp

  • How can I display multiple column results of a sql query?

    I'm wanting to display the results of a query selecting from multiple columns, but I can't seem to find an item type that will allow this. I've tried LOV, multiselect, display as text and others. Any ideas on how to do this. Here is my basic query:
    Select ul.meaning,
    rqa.submission_date,
    rqa.location_num
    from
    cfa_rqa_doc_submit_dates rqa,
    cfa_user_lookups ul
    where
    rqa.location_num in (Select location_num from cfa_current_locations_mv
    where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
    and
    ul.lookup_type_id='1269'
    and
    to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
    and
    rqa.submission_date >= (SYSDATE-365)
    and ul.lookup_ID= rqa.document_type_id
    ;

    Hi,
    Do you just wish to display the result of the query? If so, you can simply parse it out in HTML.
    You can then choose if you want to use tables or css.
    Multiple column layout in tables are based on <tr> and <td>.
    <tr> is a table row, where <td> is a column.
    All tags should be closed.
    Example:
    <table>
    <tr>
    <td>col1</td><td>col2</td>
    </tr>
    <tr>
    <td colspan="2">spans over 2 cols</td>
    </tr>
    </table>If you want to do the same in css:
    (Seems this forum removes the styles!):
    float:left; width:50; << first div and 2 div (col 1 and col 2 style)
    float:left;clear:both; width:100%; << clear both, double width (spans over 2)
    <div>
    <div style="float:left; width:50;">col1</div><div style="float:left;width:50%;">col2</div>
    <div style="float:left;clear:both; width=100%;">Spans over 2 cols</div>
    </div>The div might look more complicated, but if you refrain from styling in the tags them selves, you can define different styles in the .css file.
    You need the clear:both to start a new line with the divs that float.
    I usually run a dedicated "new line" div, without content.. (exception beeing the html-entities version of ' ' (& nbsp ; << without the spaces)).
    eg.:
    <div style="cls"> </div>Parsing out the values from the PL SQL you do like so:
    begin
    declare
       cursor c_search is 
    Select ul.meaning,
    rqa.submission_date,
    rqa.location_num
    from
    cfa_rqa_doc_submit_dates rqa,
    cfa_user_lookups ul
    where
    rqa.location_num in (Select location_num from cfa_current_locations_mv
    where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
    and
    ul.lookup_type_id='1269'
    and
    to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
    and
    rqa.submission_date >= (SYSDATE-365)
    and ul.lookup_ID= rqa.document_type_id
    begin  
    htp.p('<div style="width:80%;">');
    for v_search in c_search loop
    htp.p('<div style="float:left;clear:none;">'||v_search.location_num||'</div>');
    htp.p('<div style="float:left;clear:none;">'||v_search.submission_date||'</div>');
    end loop;
    htp.p('</div>');
      end;
    end;Ps. hope I understood you correctly, also this code is untested.. but I hope it can still help.
    Edited by: Olav Alexander Mjelde on May 12, 2010 9:36 AM

Maybe you are looking for