How to divide the DB results in addition to a column

I have some code (see below) which separates the results from a query db in two columns. However, the results print left to right, row by row. Which displays almost correctly, however, I need to display the results of the first half in a column, and the second half of the results in a second column. I can't understand how to change the code to display the first column with 1/2 of the results.


< CFSET maxcol = 2 >
< TABLE BORDER = "0" cellpadding = "3" cellspacing = "0" >
< CFSET outcol = 0 >
< CFOUTPUT QUERY = "Candidate" >
< CFIF outcol EQ 0 > < TR > < / CFIF >
< TD width = "30%" > < span class = "BodyContent" > #Candidate # </span > < table >
< CFSET outcol = outcol + 1 >
< CFIF outcol EQ maxcol >
< /TR >
< CFSET outcol = 0 >
< / CFIF >
< / CFOUTPUT >
< CFIF outcol NEQ 0 > < /TR > < / CFIF >

This could be a little Kludgy, but hey, it works...
First of all, a quick count of the db
SELECT COUNT (*) AS CandidateCount
Candidates

Then divide the total by 2 and 1 for good luck.

Then write on the table.





#Candidate #.



Tags: ColdFusion

Similar Questions

  • How to divide the Dates

    Hi all...

    Here, I use the following scripts...

    create table a10 (eno number, date f, date t, number of sal)

    INSERT IN A10 (ENO, F, T, SAL) VALUES)

    1, TO_Date (1 July 2013 12:00:00 AM ',' DD/MM/YYYY HH: mi: SS AM'), TO_Date (June 30, 2014 12:00 ',' DD/MM/YYYY HH: mi: SS AM')

    (100);

    INSERT IN A10 (ENO, F, T, SAL) VALUES)

    1, TO_Date (May 1, 2013 12:00:00 AM ',' DD/MM/YYYY HH: mi: SS AM'), TO_Date (April 30, 2014 12:00 ',' DD/MM/YYYY HH: mi: SS AM')

    (200);

    COMMIT;

    entry:

    ENO      F             T                SAL

    07/01/2013 2014/06/30 100 1

    1 05/01/2013 30/04/2014 200

    Expected results:

    ENO FTSAL

    1 05/01/2013 2013/06/30 200

    1 30/04/2014 300 07/01/2013

    1 05/01/2014 2014/06/30 100

    I'm little bit confused how to divide the dates here... Any help is appreciated.

    Thank you all

    Stéphane

    Hello

    Always tell what version of Oracle you are using, especially if it's so old.

    In Oracle 10 (or 9, by the way) you can do this way:

    WITH cntr AS

    (

    SELECT LEVEL AS n

    OF the double

    CONNECT BY LEVEL<=>

    )

    got_change_date AS

    (

    SELECT d.eno

    C.n

    WHEN 1 THEN f

    ANOTHER t + 1

    END AS change_date

    C.n

    WHEN 1 THEN 1

    OF ANOTHER-1

    END as mul

    sal

    BY a10 d

    CROSS JOIN cntr c

    -WHERE... - If you need any filtering, put it here

    )

    got_total_sal AS

    (

    SELECT eno

    change_date f

    Advance (change_date) OVER (PARTITION BY eno

    ORDER BY change_date

    ) - 1 AS t

    SUM (sal * mul) over (PARTITION BY eno

    ORDER BY change_date

    ) AS total_sal

    OF got_change_date

    )

    SELECT *.

    OF got_total_sal

    WHERE t IS NOT NULL

    ORDER BY eno, f

    ;

  • How to divide the column Date OBIEE

    Hello
    We have the name of the date column: To_Date and the format is DD/MM/YY hh.
    How to divide the date in YEARS, MONTHS, DAY as new columns.
    kindly help on that.


    Kind regards.
    CHR

    Published by: 867932 on November 23, 2011 22:18

    Hi user,

    All 3 functions can be written in RPD too. MDB layer, duplicate the date column-> the mapping tab to column of Goto-> expression-> functions Builder Select-> calendar Date functions / hour-> select DayofMOnth function. The column of your logic formula will look like,

    DayofMonth (YourDateColumn)

    Rgds,
    DpKa

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • How to divide the Recordset by groups in SQL itself.

    Hi, I use 10.2.4.0 Oracle.
    I have only one requirement, to whom I have to divide the recordset in some groups, so that they can be executed in part, but not in a single pass.

    So, in the 'SELECT' clause itself I want to asssign special value (can be 1) to 50000 first then saves another value (maybe 2) to 10000 next, like wise. And yet once the total number of records will also be successive varry, if the total number of recordset is less than 10,000, then it should only affect '1' to all records. I'll put the values of the Group (1,2,3...) as another column itself.

    Can you please let me know if this can be done in SQL without going for PLSQL?

    Hello

    This is called a Query of paging , and here's a way to do it:

    WITH     got_grp          AS
    (
         SELECT     x.*
         ,     CEIL ( ROW_NUMBER () OVER (ORDER BY  x_id)
                   / 50000
                   )          AS grp
         FROM     table_x  x
    --     WHERE     ...          -- If you need any filtering, put it here
    )
    SELECT     *               -- Or list the columns you want
    FROM     got_grp
    WHERE     grp     = 1
    ;
    

    ROW_NUMBER () OVER (ORDER BY x_id) assigns unique integers 1, 2, 3,... to all of all lines, in the same order as x_id (even if x_id is not unique).
    CEIL (ROW_NUMBER () OVER (ORDER BY x_id) / 50000) maps the 1st 50,000 of these numbers to 1, the 2nd 50 000 votes against 2 and so on.
    Calculated analytical (like ROW_NUMBER) as functions after the WHERE clause is applied, so to use the results in a WHERE clause, then you need calculate their in a subquery. If you want to just display the number and not use in a WHERE clause, so you need not a subquery.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the or the tables changed after the DML.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

  • How to divide the resultset SQL based on the data in the form of scenarios?

    Hello

    I need to develop a query that should be divided into scenarios

    Ex:

    Scenario 1: If a product is sold to the United States and charged in the United Kingdom
    Scenario 2: If a product is sold to the United Kingdom and charged in the United States
    Scenario 3: If a product is sold and invoiced to the United States
    Scenario 4: If a product is sold and invoiced to the United Kingdom

    Based on 1 how to divide and provide SQL result to users based on the scenarios?

    Ex: Result should show all the data, saying that the result set is in scenario 1, etc..,.

    Please advice

    Thank you
    user12048986

    Hello

    You can use an expression BOX to classify each line:

    CASE  sold_country || ' ' || billed_country
         WHEN  'US UK'     THEN  1
         WHEN  'UK US'     THEN  2
         WHEN  'US US'     THEN  3
         WHEN  'UK UK'     THEN  4
    END     AS scenario_num
    

    If sold_country or billed_country is anything except 'UK' or 'US', then the above expression returns null.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.

  • How to divide the source file without losing labels

    Hello

    I wonder how I could split my file source into two (or more) without losing the tags...

    Hello again, Wolfgang!

    OK, now I understand! However, I fear that there is no import in CVI mechanism, so that you can move the tags to another folder, other than doing this manually.

    However, it would be possible to realize a work around. Since you already have this information in your file of CFS (line Tags field), you can manually copy - paste on the line numbers the new file containing the source code you cut in half of the old file. A few steps:

    1. Either your source code file containing a.c source tags.
    2. Make a copy of a.c (e.g., British Colombia) and add b.c to the project.
    3. In your CFS file, copy - paste the field line Tags of a.c to the wire to the corresponding entry of the BC.
    4. Return to CVI, ensuring that the source code and the source of British Colombia tags are a perfect clone of a.c.
    5. Make the required changes to the a.c and b.c, such as the final result is the logical split of the original file. When you change a source file lines, source tags are also moved to the source editor.
    6. The end result is the code split between a.c and British Colombia, while keeping the corresponding position of the source tags.

    I am aware that there is work involved in the execution of these operations, but the result should be your result.

    I hope this helps, Wolfgang!

  • How to divide the string in bb-cascades

    1. I have a table of data as json

      {"RegistrationResult":"Registered Success:Empid:157:TableName:COMPANY156"}
      
    2. Now, how I want to split the show list view in qml and string as the follwing

      Success stories

      EmpID = 157

      TableName = COMPANY156

    3. Please tell the concept of cutting a string and show the result in qml

    I can get the result of the follwing method:

    {"RegistrationResult":["Registered Success","Empid":"157","TableName":"COMPANY156"]}
     
    

    But I do not know how to split the string for a first... Help, please...

    svmrajesh wrote:

    1. ,......"Registered Success:Empid:157:TableName:COMPANY156"}

    Take a look at QString docu

    Just do something like

    myString.split(':')

    and you get a QStringList and this QStringList is directly mapped to a table in QML JavaScript

  • How to divide the three PARTITION HD

    I bought the new PC HP 1350EJ G6

    and

    I would like to divide the PARTITION HD 3: Application of the system, Document,

    Please how can I do?

    Thanks much AVI kl

    {Information}

    Going to be hard to do since you already have 4 primary partitions. See the link below

    http://h30434.www3.HP.com/T5/other-notebook-PC-questions/how-to-REPARTITION-HDD-of-HP-notebook-with-pre-loaded-Windows-7/m-p/742019

  • How to divide the Panel layer in two?

    How do divide you the layers panel in half? I've seen references to do this but Googling this question does not work.

    I use CS2

    Far as I can tell that the person referred to the screenshot of the layers panel appeared in the article, not the real layers panel in Photoshop.

  • How to get the desired result

    I have an accmaster say table where each record has detailts on an acct as actno, curr_bal, branch, acct_type I want something as below a
    branch_no - Sum (curr_bal) where acct_type like 1% ' as sb - sum (curr_bal) where acct_type like 2%'s fd of the Group table by branch in a single line as shown below

    00001 550000 65000000
    00002 75909000 2568229867

    Please tell how to do the above operation.

    Hello

    This is called a Pivot , and here's a way to do it:

    SELECT       branch_no
    ,       SUM (CASE WHEN acct_type LIKE '1%' THEN curr_bal END)     AS total_1
    ,       SUM (CASE WHEN acct_type LIKE '2%' THEN curr_bal END)     AS total_2
    FROM       accmaster
    GROUP BY  branch_no
    ;
    

    This will work in any version of Oracle, from 8.1, but starting in Oracle 11.1, you can also use the SELECT... Function PIVOT.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

    Furthermore, your table is called
    accmaster (where, I guess, ACC means 'account') and it contains called columns
    ACTNO ( Act means 'account') and
    acct_type ( acct means 'account')
    Do you really need 3 different ways to shorten "account"? How do you recall when you used a way and when you have used another or when you used an underscore after the abbreviation character, and when you do not have? Even if you never get confused by these things, someone trying to help you, and one that should keep your code in the future, will probably. Do not use consistent, such as namespace
    acct_master
    Acct_No and
    acct_type
    ?

  • How to divide the Source file into smaller files without export?

    Hi all

    I am a beginner with PPro CS4 and video editing in general. I did a lot of research on Google and the search of these forums for an answer to this question, but I have not found a clear answer. Here's my problem:

    I have many hours of HDV video in recent years with a Canon HV30. This sequence is on dozens of DV tape cassettes. I want to capture most of it on the disk.

    When I capture a band on the disc, I get a single large mpeg4 file. (Body captures all HDV films in mpeg4). "select Scene" does not work with the HV30, so my only way to make a small capture files would be set In/Out points with batch capture. But that would mean hours of fast forward and back with VCR type controls on the camera for the revision of all bands and points. I thought it might be more QUICK to capture everything simply a whole band at once, and THEN examine the band captured the Organization (he is much faster using the Purifier), and by dividing the file into smaller files within the Organization, thus avoiding mechanical advance and rewind on the camera itself.

    But the only way I can find for it seems to imply EXPORT clips. Am I wrong to think that the export of a clip to a new file involves a degradation of the original mpeg4 source file? Or there will be no loss of quality if I simply export to mpeg4 format?

    It seems that there should be an easy way to simply divide the initial capture in small source files for editing later, without putting the images through a new generation of (exporting) treatment, which could result in a loss of quality. Or I'm wrong about this?

    (CS4 Master Suite, i7 3630 k, 16 GB RAM, C: 256 GB SSD, 1 t D:, E: 1 t F3 setpoint setpoint F3)

    HDV film is mpeg2 (which is a number). CS4 is not scene detect you will need to use HDV split for this.

    http://strony.aster.pl/paviko/hdvsplit.htm.

    You can run your files already captured by hdv split and it will cut the file into clips and you leave.

  • How to clear the search results in an af:table?

    Hi all
    I use Jdeveloper 11 g with ADFBC.

    I have a query with a table of readonly page to display the result of the query, and there is a "Reset" button on the page (NOT reset in motion control) to clear the search results in the table.
    I try the following code to clear the contents of the search results, BUT it does not work. The data in the table is always run after the code below here.
    DCIteratorBinding binding = ADFUtils.findIterator("UserVO1Iterator");
    if (binding!=null) {
        binding.clear();
    }
    Can someone help me? How to clear the contents in an af:table supporting the Java bean code?

    Kind regards
    Samson Fu

    You can also try to call the method executeEmptyRowSet() on the view of the iterator object instance

    Sample:

    binding.getViewObject().executeEmptyRowSet()
    

    Jean Lou

  • How to get the overall result sequence into LabView?

    Hello

    Could someone can help with this little problem?

    We have a batch (.bat) that launches a list given TestStand sequences, which works as expected.

    However, we monitor the results of each sequence and display it to the operator.

    Our idea is to get the result of the sequence in a VI, executed at the end of the sequence and add it to a queue, which will be extracted and displayed on a monitor of VI, executed separately.

    The only problem we have left must be able to recover the overall result of the sequence. Any idea or suggestion?

    Thank you

    Raphael

    Thanks for all your replies. We finally finished queues sequencefailed node sequence context property value.

    I also discovered the TestStand database logging and began to use it in parallel.

    Thanks again

  • How to divide the characters in table 1 d

    I am looking for a way to divide the 'print' to a string 1-d subarray. For example instead of:

    1 / AAAABBBB

    2 / CCCCDDDD

    3 / EEEEFFFF

    ...

    etc.

    then there would be two tables 1 d separated where before there was a:

    1 / AAAA and BBBB

    2 / CCCC and Delalande

    3 / EEEE and FFFF

    ...

    etc.

    Something like that?

    You need better on where the split to take place?  I doubt somehow you want just a simple divided into a constant place.

Maybe you are looking for