Multiple Joins

Using HR demonstration schema, I am trying to understand how Oracle performs this multiple join:
select r.region_name, c.country_name, l.city, d.department_name
from departments d natural join locations l
natural join countries c natural join regions r
I ran the query using SQL Developer 2.1.1.64.45 and SQLPlus and the result I obtain is the same: 27 rows.
The documentation says that I should obtain a set of 2700 rows:
“The join between DEPARTMENTS and LOCATIONS creates an interim
result set consisting of 27 rows. These tables provide the DEPARTMENT_NAME
and CITY columns. This set is naturally joined to the COUNTRIES table. Since
the interim set does not contain the COUNTRY_ID column, a Cartesian join is
performed. The 27 interim rows are joined to the 25 rows in the COUNTRIES
table, yielding a new interim results set with 675 (27 × 25) rows and three columns: DEPARTMENT_NAME, CITY, and COUNTRY_NAME. This set is naturally joined to the REGIONS table. Once again, a Cartesian join occurs because the REGION_ID column is absent from the interim set. The final result set contains 2700 (675 × 4) rows and four columns.”
I parsed the query like it is suggested and the difference began with the second join:
select c.country_name, l.city, d.department_name
from departments d natural join locations l
natural join countries c;
I obtain a set of 27 rows instead of 675 as the documentation says (and I assume the documentation is correct).
If the result set from first Join it is fed as first term for the second join(from left to right) the result should be a Cartesian join and still my tools returns a set of 27 rows .
I verified the structure and contain of the 4 tables involved and it do match the one describe in documentation.
Why is my result different from the one provide in doc?
It is like it doesn’t matter if I select country_id column or not from first join,
somehow Oracle knows to identify the common column for the second join.

Hi,
Welcome to the forum!
user12290417 wrote:
Using HR demonstration schema, I am trying to understand how Oracle performs this multiple join:
select r.region_name, c.country_name, l.city, d.department_name
from departments d natural join locations l
natural join countries c natural join regions r
I ran the query using SQL Developer 2.1.1.64.45 and SQLPlus That's a very good idea to post the exact version number of your front end!
The version of your database can make a big difference, too. Don't just put an easy-to-miss tag, like "11g" on your message; come right out and say "I'm using Oracle 11.1.0.7.0" (or whatever it is).
and the result I obtain is the same: 27 rows.
The documentation says that I should obtain a set of 2700 rows:I get 2700 rows, using Oracle 10.2.0.1.0 Express Edition. I might be able to test it on Oracle 11 tomorrow.
“The join between DEPARTMENTS and LOCATIONS creates an interim
result set consisting of 27 rows. These tables provide the DEPARTMENT_NAME
and CITY columns. This set is naturally joined to the COUNTRIES table. Since
the interim set does not contain the COUNTRY_ID column, a Cartesian join is
performed. The 27 interim rows are joined to the 25 rows in the COUNTRIES
table, yielding a new interim results set with 675 (27 × 25) rows and three columns: DEPARTMENT_NAME, CITY, and COUNTRY_NAME. This set is naturally joined to the REGIONS table. Once again, a Cartesian join occurs because the REGION_ID column is absent from the interim set. The final result set contains 2700 (675 × 4) rows and four columns.”Can you post a link, or at least a reference, to the source of this quote? Is it describning Oracle 11 specifically?
I parsed the query like it is suggested and the difference began with the second join:
select c.country_name, l.city, d.department_name
from departments d natural join locations l
natural join countries c;
I obtain a set of 27 rows instead of 675 as the documentation says (and I assume the documentation is correct).Again, I get 675 rows, like your source.
If the result set from first Join it is fed as first term for the second join(from left to right) the result should be a Cartesian join and still my tools returns a set of 27 rows .
I verified the structure and contain of the 4 tables involved and it do match the one describe in documentation.
Why is my result different from the one provide in doc?
It is like it doesn’t matter if I select country_id column or not from first join,
somehow Oracle knows to identify the common column for the second join.Yes, the behavior you're seeing does seem to be like that.
When you explicitly give the join conditions in an ON clause, you can use any columns in any table that's been introduced up to that point. You're not limited to columns that are in the SELECT clause. The behavior you're seeing is consistent with that.
For what it's worth, the only people I've ever heard of using NATURAL JOIN are students, and even then, only if they are very diligent about following instructions. In real life, there are so many generic column names, such as QUANTITY, or MODIFY_DATE_TIME, that NATURAL JOIN is often meaningless. Also, it's a very fragile technique. If someone adds a column to a table, suddenly dozens of queries using NATURAL JOINs could start giving bad results. Most people want to write robust code, and minimize the probability of needing to re-write it.
There are lots of good places to invest your time, and lots of useful things to learn in Oracle. Spend your time learning about things that you might use, such as regular expressions, or analytic functions, or recursive sub-queries, before you spend too much time on NATURAL JOIN (or USING).

Similar Messages

  • Multiple joins on the same table

    I'm new to SQL 2005 & C# - I'm a MySQL/PHP crossover.
    I'm using s Stored Procedure and I'm trying to do multiple joins onto
    one table.  I have 6 fields in one table that are foreign keys of
    another table:
    Table1
    id
    PrimaryCode
    SecondaryCode1
    SecondaryCode2
    SecondaryCode3
    SecondaryCode4
    SecondaryCode5
    Table 2
    id
    Title
    CommCode
    The fields in table 1 (except is obviously) hold the id of a row in
    Table 2.  When displaying data I want to display "Title" -
    "CommCode" for each item in Table 1.  I got myself started by
    searchig on the net and I have a stored procedure.  The obvious
    problem is that as it goes through the Query only the last value
    remains in place - since each value before it is cleared in the
    UNION.   How can I do this??  Here's my Stored Procedure:
    =====================================
    ALTER PROCEDURE GetRegistersSpecific
    @SearchTxt int
    AS
    SELECT
    registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
    PrimaryCode AS MyID, Title, CommodityCode
    FROM registrations
    JOIN CommodityCodes ON PrimaryCode = CommodityCodes.id
    UNION
    SELECT
    registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
    SecondaryCode1 AS MyID, Title, CommodityCode
    FROM registrations
    JOIN CommodityCodes ON SecondaryCode1 = CommodityCodes.id
    UNION
    SELECT
    registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
    SecondaryCode2 AS MyID, Title, CommodityCode
    FROM registrations
    JOIN CommodityCodes ON SecondaryCode2 = CommodityCodes.id
    UNION
    SELECT
    registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
    SecondaryCode3 AS MyID, Title, CommodityCode
    FROM registrations
    JOIN CommodityCodes ON SecondaryCode3 = CommodityCodes.id
    UNION
    SELECT
    registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
    SecondaryCode4 AS MyID, Title, CommodityCode
    FROM registrations
    JOIN CommodityCodes ON SecondaryCode4 = CommodityCodes.id
    UNION
    SELECT
    registrations.Company,registrations.Address1,registrations.Address2,registrations.City,registrations.State,registrations.Zip,registrations.ContactName,registrations.Phone,registrations.Fax,registrations.Email,registrations.Website,registrations.Feid,registrations.BusinessType,registrations.BackupWitholding,registrations.SignedName,registrations.SignedDate,
    SecondaryCode5 AS MyID, Title, CommodityCode
    FROM registrations
    JOIN CommodityCodes ON SecondaryCode5 = CommodityCodes.id
    WHERE registrations.ID = @SearchTxt
    =====================================
    Thanks

    Well, I tried using UNION ALL and got the same response.  I also tried doing :
    Title AS SecTitle1
    Title AS SecTitle2
    Title AS SecTitle3
    etc...
    I get different values in the Output Window when I execute the query,
    but as expected it only returns the first value since the script
    executes all the way through before it outputs values.
    Here's how I'm executing:
    while (rdr.Read())
                    // get the results of each column
    string company = (string)rdr["Company"].ToString();
    string address1 = (string)rdr["Address1"].ToString();
    string address2 = (string)rdr["Address2"].ToString();
    string city = (string)rdr["City"].ToString();
    string state = (string)rdr["State"].ToString();
    string zip = (string)rdr["Zip"].ToString();
    string phone = (string)rdr["Phone"].ToString();
    string fax = (string)rdr["Fax"].ToString();
    string email = (string)rdr["Email"].ToString();
    string website = (string)rdr["Website"].ToString();
    string feid = (string)rdr["Feid"].ToString();
    string businessType = (string)rdr["BusinessType"].ToString();
    string contactName = (string)rdr["ContactName"].ToString();
    string primaryCode = (string)rdr["PrimTitle"].ToString();
    string secondaryCode1 = (string)rdr["SecTitle1"].ToString();
    string secondaryCode2 = (string)rdr["SecTitle2"].ToString();
    string secondaryCode3 = (string)rdr["SecTitle3"].ToString();
    string secondaryCode4 = (string)rdr["SecTitle4"].ToString();
    string secondaryCode5 = (string)rdr["SecTitle5"].ToString();
    string backUp = (string)rdr["BackupWitholding"].ToString();
    string signedName = (string)rdr["SignedName"].ToString();
    string signedDate = (string)rdr["SignedDate"].ToString();

  • How to refresh a table with multiple joins

    Hi,
    First at all, I'm newby in ADF, and my english is no so good, sorry for that...
    I'm using JDeveloper 11g Release 2 (11.1.2.3.0). I have a table created from a view object that have multiple joins with other entities. When I insert a new row programmatically in one of the entities of the joins (not in the entitiy of the view object itself), the new row is created in the database correctly but the table don't show it. What can I do to refresh the table to see the new row created?
    Thanks in advance!

    You have to update the iterator the table is based on for the ui last. You do that by executing the query on the iterator again.
    Timo

  • Performance Issue with Multiple Joins :-)

    Hi there! I have a dilemma over using multiple joins...and I am not sure whether there is any alternative to this. Please help me out if you can..
    I have a table DATA having 100 columns and 2 million records and I have another metadata table Code_Mappings. The issue is with migration of this data from upstreams to downstreams.
    Columns of DATA table is
    a,b,c,d,e,f,g,h.......ca.cb.cc.cd.....dz.
    Code_Mappings table is
    Source_code |Target code | category
    The problem arises when I join the metadata table for multiple joins..
    Around 75 columns out of 100 are category questions i.e I need to replace all Source codes in the data of those category columns with target codes WRT categories..
    Suppose A, C,D,I,J,K,L,W,X,Z,AA,BH are country category.
    My query to fetch data from DATA for column A would be
    Select decode(d.A, cm.source_code,cm.target_code,d.A) from DATA D,Code_Mappings CM where cm.category like 'country' and d.A=cm.source_code;
    In the similar way, I may have to join the same table for category 'country' for n no of columns if those columns have category as 'country'.
    Is there a alternative to use this table once and use the decode, mapping logic multiple times on columns..? Please let me know if there is anyways I can do it so that performance is enhanced in a significant manner.
    Another Issue is:
    Whenever the Column value is some junk, that record doesnt get fetched. In the above query, you can see that where clause has a condition of "d.A=cm.source_code" which not only filters out these required records but also avoids cartesian product.
    The basic requirement is all records should get fetched. I do not want to filter out anything.
    Please help me out.
    Thanks
    Mahesh

    1) I'm not a JD Edwards person, but I would wager that if you're to the point where you have consolidated all the schemas to a single instance that it would be possible and preferrable to consolidate everything further into a single schema. I have to believe that JD Edwards provides tools to restrict what bits a particular branch can see without requiring separate instances.
    2) What data are you accessing exactly? Are you always accessing data for a particular branch? Or do you need information from every branch?
    3) Is your application logging in as a single user? Or will there be 1 application user for every JD Edwards schema?
    4) Are you deploying your PL/SQL into 10-20 different schemas? Or into just 1?
    Whether or not you are explicitly using the schema name, Oracle will have to do a hard parse of every logically distinct SQL statement. Two SQL statements that access different tables that happen to share the same name are logically distinct, so your shared pool will end up with 10-20 copies of the "SELECT * FROM <<some table name>>" SQL statement if it is executed against every instance of <<some table name>>.
    The question may be whether it is better to explicitly provide the schema name or to rely on synonyms. You generate the same number of hard parses either way, but explicit schema names may improve latch contention during parses if Oracle has to do a lot of synonym resolution. Not many people/ applications are really hurt by this latch contention, though, so it is very hard to say whether this is a legitimate concern.
    Justin

  • Can we create a multiple joins in physical layer

    Hi,
    I have a requirement that i want to create a multiple joins in physical layer.
    Ex:
    Table a (custid,name,sal) and tableb (custid,ced_id, loc)
    i had requirement that cust id is joining with custid and cedid from table b
    i.e a.custid=b.custid AND
    a.custid=b.ced_id (Note data types are same across all the joins here).
    When am trying to handle it form physical joins, getting an issue that The column'cusid' is used twice.
    Regards,
    Malli

    As Daan said use complex join in physical layer that should work. Just in case its not working then go with 1 join condition physical layer and create foreign key join in BMM layer, this would override join in physical layer.

  • Error: 38015, Physical tables have multiple joins.

    Hi,
    I have 5 dimensions and 1 fact table. One of the dimension table have 2 keys, which are referenced with fact table.
    I have created aliases for all table on which I have defined joins.
    But, It is giving me error like
    ERRORS:
    GLOBAL:
    *[38015] Physical tables "obidb".."ORDER_DETAILS"."FACT" and "obidb".."ORDER_DETAILS"."BILLING_ACCOUNT" have multiple joins.*
    Delete new foreign key object if it is a duplicate of existing foreign key.
    Please give me any suggestions.....
    Thanks.

    Hi,
    Did your deleted existing foreign key before joining the alis_dim1(fk1), dim1(fk2) to fact join?
    double check u r model its comes like circular join so by using alias method u r can resolve that issue.
    In your model just check all your FK relation ship here u can find FK ending with #1 (double time just delete them and check metadata consitancey) if its not working delete the dimension and import it newly then create alias of the dim then join each other required fact also check below link
    http://mtalavera.wordpress.com/2012/03/29/obieerpd-fails-global-consistency-on-joins-between-tables/
    Thanks
    Deva
    Edited by: Devarasu on Nov 23, 2012 4:44 PM

  • Multiple joins Problem in Physical Layer.

    I have two tables Departments and Employees in the physical layer of admin tool. When i am trying
    to create foreign keys at physical diagram its giving error.
    Scenario:
    Departments                    
    ===========               
    Department_id (PK)               
    Manager_id (FK)                    
    Employees
    ========
    Employee_id (PK)
    Department_id (FK)
    Manager_id (FK)
    1. Manager_id of Departments table references Employee_id of Employees table
    2. Department_id of Employees table references Department_id of Departments table.
    3. Manager_id of Employees table references Employee_id of Employees table.
    I have done 1st one. After 2nd one i have tested for consistency check, the following error is coming:
    [38015] Physical tables "Oracle DB Connection".."HR"."EMPLOYEES" and "Oracle DB Connection".."HR"."DEPARTMENTS" have multiple joins.
    Delete new foreign key object if it is a duplicate of existing foreign key.
    How to solve this?
    How to do 3rd one also?
    Please clarify.
    regards
    chandra kanth
    Edited by: Chandra kanth on 08-Dec-2011 01:47

    Hi,
    I have created two alias tables (E1 Employees, D1 Departments) for Employees, Departments tables.
    I have created foreign key joins as follows:
    D1 Departments:
    EMPLOYEES.EMPLOYEE_ID = "D1 DEPARTMENTS".MANAGER_ID
    E1 Employees:
    EMPLOYEES.EMPLOYEE_ID = "E1 EMPLOYEES".MANAGER_ID
    and it is consistent also. Please let me know whether the above approach is right or not.
    regards
    chandra kanth.

  • Error when Check global consistency: Physical tables have multiple Joins

    Hi
    I have a table that have multiple joins with a dimension in the physical layer, this is a fact table and the dimension is a geograhic dimension, and in the fact table I have three codes, customer geography, account geography and office geography. This is a simple model and is correct for my DWH. However when I want to check global consistency the consistency check manager display the next error (three times):
    ERRORS:
    GLOBAL:
    [38015] Physical tables "ODS".."ODS"."FT_INTERFAZ_CICLO_FACTURACION" and "ODS".."ODS"."DIM_GEOGRAFIA" have multiple joins. Delete new foreign key object if it is a duplicate of existing foreign key.
    [38015] Physical tables "ODS".."ODS"."FT_INTERFAZ_CICLO_FACTURACION" and "ODS".."ODS"."DIM_GEOGRAFIA" have multiple joins. Delete new foreign key object if it is a duplicate of existing foreign key.
    [38015] Physical tables "ODS".."ODS"."FT_INTERFAZ_CICLO_FACTURACION" and "ODS".."ODS"."DIM_GEOGRAFIA" have multiple joins. Delete new foreign key object if it is a duplicate of existing foreign key.
    How can I do to solve this error?
    Thanks
    Edwin

    I have one dim table name team.
    In the dim table there are two primary keys like Team key and Team Type key.
    In the Fact table there are 4 foriegnkey like
    a) Sales team key
    b) Sales team type key
    c) Trader team key
    d) Trader team type key
    For this purpose , i am going to create the alias table in the physical layer. Can any body explain to me the whole process

  • Multiple Joins from one Dimension Table to single Fact table

    Hi all,
    I have a single fact table with attributes as such:
    Action_ID
    Action_Type
    Date_Started
    Date_Completed
    and a Time Dimension to connect to the fact table. Currently the 2 Date columns in my fact table are in the format of 20090101 (which is the same as my key in the time dimension), if it means anything. I've tried to create multiple joins but have been getting error messages. What is the easiest way to link the time dimension with the two date columns in my fact table? Thanks.

    hi..
    it seems to be, you need to use between operator to join time dimension with fact (i.e. Non-equi join)
    If it's then you should create complex join in physical layer by connecting dimension with your fact.
    select columns and operators in such a way that it resembles something like the below.
    timeDimension.timeKey BETWEEN FactTable.Date_Started AND FactTable.Date_Completed

  • Compensation within Multiple-Join

    In a process, I define a global exception (not an exception transition. It is an exception event). After this exception, it is a compensation event (not the compensation transition), an interactive activity named showResult, and an automatic activity (named GoTo). The showResult can get the user selection options including back/skip. The GoTo automatic activity can return the instance to the place where the exception is thrown.
    In the process, there is a multiple-join activity. Inside the Multiple-Join, there is an interactive activities. I can define the branch number in the runtime. The Join activity can throw a business exception and cought by the exception handle.
    I set all branch to the the fault situation (interactive activity in each brance cannot throw exception). Each brance has a number as follows:
    /instance number/1
    /instance number/2
    /instance number/3
    All the above instances are in the Join.
    Then the instance (/instance number/0 ) is in the activity showResult. However, I do not know how to make this instance return to Multiple and redo the interactive activity inside this Gate
    Sincerely

    If your condition is more complex (not just the number of completed copies) you can always do it using the action variable in the Multiple-Join activity:
    if( ... ) {
        action = RELEASE;
    }

  • Problems using multiple joins for search

    I am new to dreamweaver and coding and I am battling to get my head around joining tables and using multiple joins to create a search result recordset.
    I have a the following tables setup;
    Venues table
    venueID
    name
    category (text)
    city
    provinceID (numeric)
    country
    maxcapacity
    Province table
    provinceID
    province (text)
    Category Table
    categoryID
    category (text)
    Max Conference Table
    conferencefacilitiesID
    venueID
    maxcapacity
    I am passing the search $_POST variables via a form and displaying it in a results page.
    I have successfully done the search using only one table the problem results in using multiple joins. I cam not sure of the syntax to use but have successfully created the results page, using the outer join to link the province, category and maxcapacity to the venues table. Not all the venues have conferencing so I think need to use outer join for conferencing.
    I can't seem to access the search and not sure if I can use the WHERE command to set varialbe 'category' = varCategory 
    Below is my code which doesn't work;
    SELECT wp_dbt_venues.venuesID, wp_dbt_venues.name, wp_dbt_venues.category, wp_dbt_venues.province, wp_dbt_venues.city, wp_dbt_province.provinceID, wp_dbt_province.province, wp_dbt_conferencefacilties.venueid, wp_dbt_conferencefacilties.maxcapacity
    FROM ((wp_dbt_venues LEFT OUTER JOIN wp_dbt_province ON wp_dbt_venues.province = wp_dbt_province.provinceID)  LEFT OUTER JOIN wp_dbt_conferencefacilties ON wp_dbt_venues.venuesID = wp_dbt_conferencefacilties.venueid)
    WHERE 'category'=varCategory
    I would like to get on variable working and then expand onto the others like WHERE maxcapacity < varCapacity

    Hi bregent
    Thank you for all the help, below is the code. I have clened it up as best I could as dreamweaver seems to add recordset everytime I edit it. I then have to delete the old code. It also seems adds a totalRows variable and moves one of the runtime variables to the totalRows variable. Its all very confusing but its working.
    Results Page
    <?php require_once('Connections/tova.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
       $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    if (isset($_POST['delegates'])) {
      $varDel_results = $_POST['delegates'];
    $varProv_results = "-1";
    if (isset($_POST['province'])) {
      $varProv_results = $_POST['province'];
    $varCat_results = "-1";
    if (isset($_POST['category'])) {
      $varCat_results = $_POST['category'];
    mysql_select_db($database_tova, $tova);
    $query_results = sprintf("SELECT wp_dbt_venues.venuesID, wp_dbt_venues.name, wp_dbt_venues.category, wp_dbt_venues.province, wp_dbt_venues.city, wp_dbt_province.provinceID, wp_dbt_province.province, wp_dbt_conferencefacilties.venueid, wp_dbt_conferencefacilties.maxcapacity FROM ((wp_dbt_venues LEFT OUTER JOIN wp_dbt_province ON wp_dbt_venues.province = wp_dbt_province.provinceID)  LEFT OUTER JOIN wp_dbt_conferencefacilties ON wp_dbt_venues.venuesID = wp_dbt_conferencefacilties.venueid) WHERE wp_dbt_venues.category = %s AND wp_dbt_venues.province = %s AND wp_dbt_conferencefacilties.maxcapacity < %s", GetSQLValueString($varCat_results, "text"),GetSQLValueString($varProv_results, "int"),GetSQLValueString($varDel_results, "int"));
    $results = mysql_query($query_results, $tova) or die(mysql_error());
    $row_results = mysql_fetch_assoc($results);
    $totalRows_results = mysql_num_rows($results);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <p>Search Results</p>
    <table width="200" border="1">
      <tr>
        <td> </td>
        <td>Name</td>
        <td>Category</td>
        <td>City</td>
        <td>Province</td>
        <td>Delegates</td>
      </tr>
      <?php do { ?>
        <tr>
          <td><?php echo $row_results['venuesID']; ?></td>
          <td><?php echo $row_results['name']; ?></td>
          <td><?php echo $row_results['category']; ?></td>
          <td><?php echo $row_results['city']; ?></td>
          <td><?php echo $row_results['province']; ?></td>
          <td><?php echo $row_results['maxcapacity']; ?></td>
        </tr>
        <?php } while ($row_results = mysql_fetch_assoc($results)); ?>
    </table>
    <p> </p>
    </body>
    </html>
    <?php mysql_free_result($results);
    ?>
    Search Page
    <?php require_once('Connections/tova.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_tova, $tova);
    $query_category = "SELECT category FROM wp_dbt_categories ORDER BY category ASC";
    $category = mysql_query($query_category, $tova) or die(mysql_error());
    $row_category = mysql_fetch_assoc($category);
    $totalRows_category = mysql_num_rows($category);
    mysql_select_db($database_tova, $tova);
    $query_province = "SELECT * FROM wp_dbt_province ORDER BY province ASC";
    $province = mysql_query($query_province, $tova) or die(mysql_error());
    $row_province = mysql_fetch_assoc($province);
    $totalRows_province = mysql_num_rows($province);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Search</title>
    </head>
    <body>
    <p><strong>Advanced Search</strong></p>
    <form action="results.php" method="post" name="form1" target="_blank" id="form1">
      <p>
        <label>Category
          <select name="category" id="category">
            <?php
    do { 
    ?>
            <option value="<?php echo $row_category['category']?>"<?php if (!(strcmp($row_category['category'], $row_category['category']))) {echo "selected=\"selected\"";} ?>><?php echo $row_category['category']?></option>
            <?php
    } while ($row_category = mysql_fetch_assoc($category));
      $rows = mysql_num_rows($category);
      if($rows > 0) {
          mysql_data_seek($category, 0);
                $row_category = mysql_fetch_assoc($category);
    ?>
          </select>
        </label>
      </p>
      <p>
        <label>Province
          <select name="province" id="province">
            <?php
    do { 
    ?>
            <option value="<?php echo $row_province['provinceID']?>"<?php if (!(strcmp($row_province['provinceID'], $row_province['provinceID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_province['province']?></option>
            <?php
    } while ($row_province = mysql_fetch_assoc($province));
      $rows = mysql_num_rows($province);
      if($rows > 0) {
          mysql_data_seek($province, 0);
                $row_province = mysql_fetch_assoc($province);
    ?>
          </select>
        </label>
      </p>
      <p>
        <label>Delegates
          <input name="delegates" type="text" id="delegates" value="" />
        </label>
      </p>
      <p>
        <label>
          <input type="checkbox" name="Facilities" value="golf" id="Facilities_0" />
          Golf</label>
        <br />
        <label>
          <input type="checkbox" name="Facilities" value="game" id="Facilities_1" />
          Game</label>
        <br />
      </p>
      <p>
        <label>Search
          <input type="submit" name="submit" id="submit" value="Submit" />
        </label>
      </p>
    </form>
    <p> </p>
    </body>
    </html>
    <?php
    mysql_free_result($category);
    mysql_free_result($province);
    ?>

  • Multiple Joins - or Joins in General -- Impossible in Discoverer????

    I would like to do multiple joins in Discoverer and/or custom sql.... How do I do this? Currently I can only do joins on Aggregated/Calculated Items

    Hi,
    You can still use simple folders for more complex joins.
    Eg: where (a.col1 = b.col1) ....
    AND ( (a.col2 = b.col2) OR (a.col2 is null ) )
    This can be achived using Disco Administrator > right click on col name > create join
    create all 3 joins in the same level > select 2 joins which you want to be in inner level select join1 + Shift key + join 2 > select And . This will add a group.The advantage of using simple folder is that you can have all the columns of the table in one shot. If you need only few columns then you can use custim folder, add custom SQL query.
    Hope this helps!
    Yogini

  • Error: There are multiple join paths between these folders

    I occasionally see this multiple join path error message when collapsing a field in a cross-tab report. The strange thing is that this error only occurs when collapsing on detail of the field, but does not happen when collapsing on the field title. For example, if the column is the department field, there is no error when collapsing on the department title at the top of the column. However, when collapsing on a single department (e.g. president_office) then the error occurs. The second odd thing, when reviewing the SQL there is only one join to the department table.
    Does anyone have an explanation, solution, or a suggestion on how to debug this error? Sometimes I found that by rearranging the layout of the fields fixes the problem, but this is not an option in every report.
    thanks

    Since it's using the "Firstname lastname" to reference the user when I use add-distributiongroupmember, I suspect that referencing the smtp address would return different results.
    Does Add-DistributionGroupMember reference AD objects, even if they don't have an associated mailbox? I ran into the same error when giving myself full permissions on a mailbox; I have only one Exchange object (a mailbox) but I have a second
    AD object (user object with dom admin rights). I then went and found that the user I had trouble adding to the DG has an
    AD object with no associated mailbox. (We frequently create AD users for business partners to access published remote applications.)
    My suspicion is that Add-DistributionGroupMember references AD objects, and not just valid Exchange recipients. This would make sense if you're using security enabled groups and having them pull double duty - which we don't do at this company.
    If my suspicion is correct, it should be documented on the technet article. http://technet.microsoft.com/en-us/library/aa995970(v=exchg.141).aspx

  • T-SQL - Using Column Name in where condition without any references when having multiple tables that are engaged using multiple joins.

    Hi All,
    I am a newbie for T-Sql, I came across a SP where multiple tables are engaged using multiple joins but the where clause contain  a column field without any table reference  and assigned  for an incoming variable,like 
    where 'UserId = @UserId'
    instead -  no table reference like 'a.UserId = @Userid'   ............ Can any please do refer to me any material that clears my mind regarding such issue................... help is appreciated.
    Thank You.

    As suggested above, use table alias with columns for unique referencing and to make the code easier to read.
    BOL example for table aliasing:
    USE AdventureWorks;
    GO
    SELECT S.CustomerID, S.Name AS Store, A.City, SP.Name AS State, CR.Name
    AS CountryRegion
    FROM Sales.Store AS S
    JOIN Sales.CustomerAddress AS CA ON CA.CustomerID = S.CustomerID
    JOIN Person.Address AS A ON A.AddressID = CA.AddressID
    JOIN Person.StateProvince SP ON
    SP.StateProvinceID = A.StateProvinceID
    JOIN Person.CountryRegion CR ON
    CR.CountryRegionCode = SP.CountryRegionCode
    ORDER BY S.CustomerID ;
    GO
    GO
    LINK:
    http://technet.microsoft.com/en-us/library/ms124824(v=sql.100).aspx
    Check the use of TABLE ALIASes and COLUMN ALIASes in the following blog:
    http://www.sqlusa.com/bestpractices2005/organizationtree/
    Without the use of aliases the code would become unreadable.
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Cdc on multiple joined source datastores

    Hi gurus,
    There are multiple source datastores and one target datastore in my interface.All of source datastores will be modified by ct application in future,How to enable cdc on multiple source datastores ?Is there any "thumb of rule" for cdc of multiple joined source datastores?
    Source: DB2/AS400
    Target: SQL SERVER 2000
    Thanks
    nan

    Hi nan,
    As i wasn't tried CDC on the source and target you specified,to give you a hint,
    For achieving CDC on multiple data stores, you can use JKM Consistent mode. This will make sure that all your data stores within the particular model will be CDC'ed and PK and FK relations will be maintained.
    Thanks,
    G

Maybe you are looking for

  • Background job scheduling for CAT2_ISCR

    Hi Experts, I have a customized program that will triiger CAT2_ISCR to run in background, it is possible? When I execute the program, I had this message: Control Framework: Fatal error - GUI cannot be reached. Why is it so? This doesn't occurs when I

  • Reset F.05

    I have old bal of 20 USD in Oct. if I use reset function, besides choose "bal sheet prepa valuation", do I also need to choose "create postings", posting date to be 31.Oct.2009, reversal date to be 1.Nov.2009 and reversal posting in postings tab? bef

  • Is HTML DB 10g the same as Apex 3?

    Hi We updgraded our database from 9i to 10g, and I was going through the "New Features" documentation. For my surprise, there is a section there called "Oracle HTML DB Improvements". I thought that APEX used to be called HTML DB and both were in fact

  • Function module RH_RELATION_MAINTAIN

    Hi Experts, I am using the function module RH_RELATION_MAINTAIN to create relation between position and costcenter. The relationship (a011)  is getting created but the percentage field PROZT is not getting updated in HRP1001 table. Can anyone tell me

  • Horrible performance (downloading not w/ Torrents)

    This applies to both torrents and non-torrents. I can get a perfect connection without modifying any settings in my previously used Linksys router (pretty much similar set up with the AEBSn didnt set any port mapping or anything other than let it do