How to group returned recordset

My current recordset returns the following:
Africa
   Egypt
Africa
   Namibia
Africa
   Morocco
America, Central
   Mexico
America, North
   United States
America, North
   Canada
How do I group this recordset according to region? So it returns the following (exercise taken from a book):
Africa
   Egypt
   Namibia
   Morocco
America, Central
   Mexico
America, North
   United States
   Canada
MySQL select statement:
mysql_select_db($database_conn_newland, $conn_newland);
$query_rs_countriesbyregion = "SELECT countryID, region, countryName, regionID, regionName FROM tbl_country, tbl_region WHERE tbl_country.region = tbl_region.regionID ORDER BY regionName ASC";
$rs_countriesbyregion = mysql_query($query_rs_countriesbyregion, $conn_newland) or die(mysql_error());
$row_rs_countriesbyregion = mysql_fetch_assoc($rs_countriesbyregion);
$totalRows_rs_countriesbyregion = mysql_num_rows($rs_countriesbyregion);mysql_select_db($database_conn_newland, $conn_newland);
My table code:
<body>
<h2><strong>Group by Region:</strong></h2>
<table width="30%" border="0" cellspacing="0" cellpadding="3">
  <?php do { ?>
    <tr>
      <td scope="col"><strong><?php echo $row_rs_countriesbyregion['regionName']; ?></strong></td>
    </tr>
    <tr>
      <td>    <?php echo $row_rs_countriesbyregion['countryName']; ?></td>
    </tr>
    <?php } while ($row_rs_countriesbyregion = mysql_fetch_assoc($rs_countriesbyregion)); ?>
</table>
Kindly help, or point me to a web resource.

Is there anyone who can help a newbie - i need to group records according to regions, then list the countries within each region: Example:
Africa
   Egypt
   Namibia
   Morocco
America, Central
   Mexico
America, North
   United States
   Canada
this exercise was from the book by Jeffrey Bardzell and Bob Flynn. Kindly refer to my previous post re the code. Please help!

Similar Messages

  • How I can return the replication groups to be in the normal state again?

    Hi All,
    can anybody help me on the following issue:
    after executing "*exec dbms_repcat.suspend_master_activity(gname=>'RG_EARMS');*"
    I got the following and it rejected to resume the replication again:
    SQL>select job, what from dba_jobs where what like '%do_deferred_repcat_admin%' ;
    JOB WHAT
    31 dbms_repcat.do_deferred_repcat_admin('"RG_ELEDGER"', FALSE);
    34 dbms_repcat.do_deferred_repcat_admin('"RG_ETBR2"', FALSE);
    4 dbms_repcat.do_deferred_repcat_admin('"RG_COMMON_PROCS"', FALSE);
    55 dbms_repcat.do_deferred_repcat_admin('"RG_EFAST"', FALSE);
    7 dbms_repcat.do_deferred_repcat_admin('"RG_EFX"', FALSE);
    35 dbms_repcat.do_deferred_repcat_admin('"RG_ESTS"', FALSE);
    9 dbms_repcat.do_deferred_repcat_admin('"RG_ESCHEDULES"', FALSE);
    75 dbms_repcat.do_deferred_repcat_admin('"RG_EARMSG"', FALSE);
    32 dbms_repcat.do_deferred_repcat_admin('"RG_CSIUSER"', FALSE);
    155 dbms_repcat.do_deferred_repcat_admin('"RG_ETOOLS"', FALSE);
    10 rows selected.
    SQL>
    select gname, status from dba_repgroup;
    SQL>
    GNAME STATUS
    RG_ETBR2 NORMAL
    RG_COMMON_PROCS NORMAL
    RG_EFAST NORMAL
    RG_EARMS              QUIESCING
    RG_EFX NORMAL
    RG_ESTS NORMAL
    RG_ESCHEDULES NORMAL
    RG_EARMSG            QUIESCING
    RG_ELEDGER NORMAL
    RG_CSIUSER NORMAL
    RG_ETOOLS NORMAL
    11 rows selected.
    SQL> select id, gname, status, master, source, oname, request
    from dba_repcatlog
    order by gname, id;
    no rows selected
    the database version is 9.2.0.8.0
    the OS is SunSolaris 9
    so, how I can return the above groups to be in the normal state again?
    Thanks and Best Regards,
    Shereif
    Edited by: user642590 on Aug 6, 2009 8:13 PM

    I don't see an "dbms_repcat.do_deferred_repcat_admin('"RG_EARMS"') job.
    The RepGroup would be quiescing but not quiesced if there are active, uncomitted transactions.
    What is the error you get when you attempt to resume -- I guess that the groups are in the queiscing state ?

  • How to "group by" and display  in separated table views

    What cloud be the approach to the following scenario:
    1) A RFC returns a list of lot of invoices.
    2 How to group by "customer code" and display in separated table views  for each customer "group of invoices" ?
    Is there a way to do this using VC or only using WebDynpro ?
    thanks

    Issac,
    you dont hv to do this using dynpro. you can achieve this in vc by using the 'Filter' operator. from the output port of the rfc, feed the results to multiple filters. hv one filter for each segregation (for eg for each customer code). Then feed these filtered entries to the table views.
    prachi

  • How can I pass Recordsets as input parameter to a Function ?

    Hi Gurus,
    I want to create a function that receive recordsets as input parameter also returns recordsets as output.
    I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
    From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
    My question is : how to pass the recordsets as input parameter to that function ?
    (because I could have 75 rows item in one order number)
    Below is the DDL and the query :
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
    insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
    insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
    insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
    insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
    insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
    insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
    insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    The query for stock taking :
    select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
    from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
    from stocks s,order_detail o
    where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
    where (sm - qty_ord) < qty_available

    Hi,
    This my requirement :
    I have (simplified)Order_Detail as below :
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    Then I want to do stock taking from my STOCK table (described on my first post on this thread)
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    The rule is : The stok taking is on First In First Out basis, on expireddate.
    And I want to do it in single query.
    I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
    That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
    Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
    I hope this clear my requirement, is this possible ?
    Thank you,
    xtanto

  • How can I return my ipad 1 to pre OS5?

    how can I return my ipad 1 to pre OS5?
    Ive been reading the forums all over the place to find the solution to my ipad 1 continually crashing. it does it mainly in safari and the app store.
    Its really annoying when you're halfway through composing a long e-mail message and it just reverts back to the home screen.
    I'm perfectly happy to give up the advantages of IOs 5, because I would rather have a stable machine (like it used to be) than use the cloud and multitasking. (I don't use them anyway). I know that some of my apps might stop working but its more important to me that the basics work.
    cheers
    Andy

    You cannot downgrade the iOS.  Once you upgrade, you're stuck with it.
    Part of your problem is that your iPad is old and it probably having difficulty keeping up with the data and protocols for the newer software.  It's probably time to send a note to Santa. 

  • How to get return value from Java runtime.getRuntime.exec?

    I'm running shell commands from an Oracle db (11gr2) on aix.
    But, I would like to get a return value from a shell comand... like you get with "echo $?"
    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        return retval;
    /but I do not get a return value... because I don't know how to get return value..
    Edited by: user9158455 on 22-Sep-2010 07:33

    Hi,
    Have your tried pr.exitValue() ?
    I think you also need a finally block that destroys the subprocess
    Regards
    Peter

  • How do I return two values from a stored procedure into an "Execute SQL Task" within SQL Server 2008 R2

    Hi,
    How do I return two values from a
    stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
    Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
    Something like ?
    CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
    @intPeriod INT,
    @strPeriod_Length NVARCHAR(1),
    @dtStart NVARCHAR(8) OUTPUT,
    @dtEnd NVARCHAR(8) OUTPUT
    AS
    then within the SSIS component; -
    Kind Regards,
    Kieran. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
    Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
    Add a script task to check ssis variables values using,
    Msgbox(Dts.Variables("User::strExtractStartDate").Value)
    Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
    Regards, RSingh

  • How do I return an unopened refurbished iBook for a complete refund?

    I ordered a refurbished 14 inch ibook a while ago and it has been sitting in an unopened box ever since. It cost about $1050. I bought this before the new intel MacBook's came out, and now that they are out, they are much better than the ibook's. Plus the iBook 14 inch is a weird ratio.
    How would i return my unopened ibook for a complete refund and only pay like 50 bucks more for a new macbook?

    Welcome to Apple Discussions!
    It depends on the store you bought it from. Read the policies of the store you bought it from, if they are posted on the web. Your "awhile ago" doesn't tell us anything about the number of days. If you have no idea when you bought it, but bought it by credit card, you can usually call the store and ask them with your credit card number to verify when that was. Most stores I've seen have a time limit on returns. Some do not accept refurbished products back. It is best to check with the individual store.

  • I just updated iOS on my iPhone 5. What a shock!! Where is the premium look and feel I bought my iPhone for? If I wanted the lokale feel of iOS 7.0 I would have bought a much cheeper taiwanese smartphone. Please let me know how I can return to the origina

    I just updated iOS on my iPhone 5.
    What a shock!! Where is the premium look and feel I bought my iPhone for?
    If I wanted the lokale feel of iOS 7.0 I would have bought a much cheeper taiwanese smartphone.
    Please let me know how I can return to the original look and feel of the iPhone surface I bought my phone for.

    You had plenty of time to look at screenshots on the internet and read various blog posts about iOS 7.

  • How can I return multiple values with PL/SQL Web Services

    Hi,
    I'm new to developping Web Services. I'm doing some tests with JDeveloper and OC4J on my local machine with a Web Services based on a PL/SQL function within a package. Right now that function only returns one value. So the xml response only has one output.
    I'd like to know how can I return multiple values with my PL/SQL Web Service. For example, if I want to return an employee's name and id? And that the xml contains two output : <employee>, <empid>?
    Reginald
    ps : I have searched the forum and I couldn't find an answer to this question, if that has been discussed AND answered before, can you please post the link? Thanks

    Alright, I actually found my answer. Since this was asked I think as a followup somewhere else I'll give my answer.
    It is very simple, all you have to do is create an Object Type and then Return that object type. After that, JDeveloper will take care of everything and you will have an xml response with multiple values. Here
    {color:#ff0000}
    create or replace TYPE person AS OBJECT
    ( id_interv number,
    first_name VARCHAR2(50),
    last_name VARCHAR2(50),
    date_birth date
    );{color}
    Then your function used in your Web Service should look something like this :
    {color:#ff0000}
    function info_emp (p_empno IN VARCHAR2) RETURN person AS
    l_emp person := person(-1,'','','');
    BEGIN
    SELECT first_name
    ,last_name
    ,emp_no
    INTO l_emp.first_name
    ,l_emp.last_name
    ,l_emp.emp_no
    FROM emp
    WHERE upper(emp_no) = upper (emp_no);
    {color}
    {color:#ff0000}
    RETURN l_emp;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    l_emp := person (-1,'n/a','n/a','n/a');
    RETURN l_emp ;
    END info_emp;{color}
    {color:#ff0000}{color:#000000}After that, this is what the xml response looks like :{color}{color}
    &lt;first_name xsi:type="xsd:string"&gt;John&lt;/first_name&gt;
    &lt;last_name xsi:type="xsd:string"&gt;Doe&lt;/last_name&gt;
    &lt;emp_no xsi:type="xsd:string"&gt;0250193&lt;/emp_no&gt;

  • How do I return an e-library book on adobe digital editions?

    How do I return an e-library book on adobe digital editions?

    You should ask in the Digital Editions forum,
    http://forums.adobe.com/community/adobe_digital_editions
    This is the Reader one.

  • IDVD 08 is a bummer. How do I return to an older version?

    I had iLife 04 on my Mac for ages, but I just bought and installed iLife 08.
    Mistake!
    IDVD 08 will not open any of my old iDVD projects; it just sits there with the beachball spinning or doing nothing at all. All the old projects now have the blue and white iDVD 08 icon, but they don't open. Likewise "Open Previous Project" doesn't work.
    So, I attempted to recreate some of my old projects in iDVD 08 by dumping the Quicktime movies that were originally used to create the old iDVD 4 projects (QuickTime movies that were exported from Final Cut Express), but I can't seem to drag and drop them into iDVD's background like I could with iDVD 4. When I drag the icon of the QT movie over into iDVD's window, the + sign does not appear, indicating that it's ready to drop, and when I let go of the mouse button, the QT movie's icon returns to the folder where the file resides.
    Most of the time, when trying to open or create any project, iDVD just sits there with its beachball spinning, or does nothing at all, so that I have to force-quit it (and then I trash the .plist).
    This version of iDVD seems like a real bummer. I can't get it to do anything.
    How do I return to iDVD 4? Can I Trash iDVD 08 and then reinstall iDVD 04 from the iLife 04 DVD?
    Tom

    Very rarely do I recommend reverting to an older version of iLife once the current version is already installed. But in your own situation, perhaps this is best ..... given the fact apple's iLife'08 isn't intended for a G4. You need a G5 or better for iMovie apparently within iLife 08. iDVD's system requirements call for at least a G4 733. But I haven't seen anyone post on this iDVD forum who has the latest version of iDVD successfully running on a G4.
    Use the following app at your own risk to remove iDVD:
    http://appzapper.com/
    Good luck!

  • How can I return to the same position in the calling order details form

    I am Calling a form for creating a new item from order details form, so after creating The new item I want to returned the item code to the calling form to same position in The order details form , how can I return to the same position in the order details form
    Waiting for your valuable answer .
    Best regards
    Jamil Alshaibani

    Dear Friends
    My actual problem description as the following
    I have a form for production order screen , and this form contain header and details blocks , so the user in the details will select Type Code , and he will go the next field that is Item Code Field search for specific Item Code if it is not exist he has to call the Item Definition Form by using this script
    CALL_FORM(ITEM_DEFINITION);
    Then when he finished defining the Item , and I assign the item code as the following in the :
    WHEN-BUTTON-PRESSED TRIGGER
    :GLOBAL.ITEM_CODE_VAR := :ITEM_CODE;
    DO_KEY('exit_form');
    But I don't know where to keep this assignment
    :ITEM_CODE := :GLOBAL.ITEM_CODE_VAR;
    inside the caller form in which trigger do I have to use when it return from the caller form it should assign the :GLOBAL.ITEM_CODE_VAR to the :ITEM_CODE and the cursor it should show inside the ITEM_CODE , and as I mention it does not return to the same location of The ITEM_CODE when it return from the calling form
    Waiting for your valuable answer .
    With example please .
    Best Regards
    Jamil Alshaibani

  • How can I return to the Classic address book 3 pane view?

    How can I return to the Classic address book 3 pane view  & get rid of the stupid fake leather and same for iCal?

    I asked the same question at the Apple Genius Bar a week or so ago and they said there was no way to change it.  I am with you - do not like this new format at all and would love it if Apple would offer both -maybe when they do an "fix" next?  This was one change in Lion that should not have been made from Snow Leopard.  I am really sorry I upgraded at this point.

  • How can I return to the top of an array indicator

    I have in my UI a 1D array indicator that I will navigate to and populate with different lists of items depending on other selections.  Always text elements.
    I have limited the number of visible rows to 20 max even though some lists will contain dozens if not hundreds of elements while others may have less than 10.  Problem is, if I scroll down the list for one population, then come back and the next list happens to have only 10 elements, the scroll bar is still way down where I had scrolled to earlier.  It is basically showing unpopulated positions in the array. (Not blank list items)
    How can I return the scroll position back up to the first element in the array when I populate it with a new list?  I looked through every property node and could find nothing.  Seems like there should be a method to refresh the display or it should go back to the top when you write a new value to it.
    Any thoughts?
    Thanks
    Doug
    "My only wish is that I am capable of learning each and every day until my last breath."

    Index Values, I think, is the property you are looking for.  Set the index to 0 to be at the top.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for