Help query MySQL DW

I am fairly new to DW and MySQL. I'm developing what I thought was a simple app search and results, but am apparently having a problem of program logic

I have a form with 2 radio buttons, the code below:

< name of the form = "card_search" id = "card_search" method = "post" action = "card_search_results.asp" >
< p >
< label >
< input < % if (CStr ((rsCardCatBaseball.Fields.Item("catID").) (Value)) = CStr("1")) then Response.Write ("CHECKED"): Response.Write("") % > type = "radio" name = "RadioGroupCardCat" value = "1" / >
Baseball < / label >
< br / >
< label >
< input < % if (CStr ((rsCardCatBaseball.Fields.Item("catID").) (Value)) = CStr("2")) then Response.Write ("CHECKED"): Response.Write("") % > type = "radio" name = "RadioGroupCardCat" value = "2" / >
Football < / label >
< br / >
< input name = "submit_card_cat" type = "submit" id = "submit_card_cat" value = "Submit" / >
< /p >
< / make >

When testing using the URL GET param. I see that the RadioGroupCardCat var = 1 (baseball) or RadioGroupCardCat = 2 (football) go directly to the page card_search_results.asp. However, I can't understand how to capture the values of RadioGroupCardCat (1 or 2) in my SQL queries. I currently have 2 recordset of applications (rsCardCatBaseball and rsCardCatFootball) below.

rsCardCatBaseball:

SELECT tblcard.cardyear, tblcardvend.vendname, tblcard.cardnum
OF tblcard, tblcardcat, tblcardvend
WHERE RadioGroupCardCat = 1 AND tblcardvend.vendid = tblcard.vendid AND tblcardcat.catid = tblcard.catid

rsCardCatFootball:

SELECT tblcard.cardyear, tblcardvend.vendname, tblcard.cardnum
OF tblcard, tblcardcat, tblcardvend
WHERE RadioGroupCardCat = 2 AND tblcardvend.vendid = tblcard.vendid AND tblcardcat.catid = tblcard.catid

"catid" corresponds to the field in MySQL table with a value of 1 (baseball) or 2 (football). I am using ASP/VBScript, so here's how the variable is declared in the variable box DW Recordset.

FOR rsCardCatBaseball:

NAME
RadioGroupCardCat

DEFAULT VALUE
1

RUNNING VALUE
Request ("CATID")

For rsCardCatFootball:

NAME
RadioGroupCardCat

DEFAULT VALUE
2

RUNNING VALUE
Request ("CATID")

The problem is that I get the same results for both queries. The rsCardCatFootball query results are identicle to the rsCardCatBaseball query. Don't I just assumed to have 2 recordsets separate in the results page so that it went from a value and other RS Gets the value else? Any help is appreciated. Thank you.

Thanks for the reply. I finally found the answer to my question at:

http://www.Adobe.com/support/UltraDev/building/multiple_param_search/multiple_param_search 05.Marco html

The declaration of variable in my SQL and DW statement were incorrect. I highly recommend the tutorial above for everyone new to DW and MySQL. The link above specifically explains how to create a variable to be used in a DW/MySQl app. thank you!

Tags: Dreamweaver

Similar Questions

  • help with a query mysql in advance

    I use 7 CF to query a MySQL 5 DB.

    I was wondering if it is possible to add an OR operator in a subquery or at the end of a conditional statement. Let's say in my statement, WHERE after a few conditions inclusive, I wanted to add a logic "AND & or.
    perhaps by including the part of my code, I can be a little clearer:

    < cfquery name = "domysearch"... >
    SELECT
    a.ID as id,
    .....
    b.Company company
    .....
    c.add_line1 as add_line1,
    .....
    OF registratn_contacts a, registratn b, registratn_addresses c
    WHERE a.owner = #arguments.owner #.
    AND b.id = a.master_record
    AND a.address_id = c.id
    AND c.state = 'NY '.
    OR c.state = 'CA '.

    I would like to know if I can or should accomplish this in my application or if I should have this logic outside the query?

    Thanks for any help!

    Carlos

    WHERE THE...
    AND (c.state = 'NY' GOLD c.state = 'CA')

    You can use a RC, it is probably preferable to use an IN clause but it is essentially a RC and would be more effective.

    AND c.state ('NY', 'CA')

    Phil

  • Help with MYSQLi query and WHILE statement

    Hello

    Do not know what is the problem here but the same record is printed in the while loop 11 times (the amount of records in the table).

    ----------------------------------------------------------

    <? PHP

    Query & main connection

    Connection to the base and the error

    $con_host = 'X '.

    $con_username = 'X '.

    $con_password = 'X '.

    $con_database = 'X '.

    $con = mysqli_connect ($con_host, $con_username, $con_password, $con_database);

    ? >

    <? PHP

    Query

    $sql = "SELECT * FROM hardware ORDER BY name ASC";

    $query = mysqli_query ($con, $sql);

    $row = mysqli_fetch_assoc ($query);

    $row_count = mysqli_num_rows ($query);

    Create Variables

    $name = $row ['name'];

    $size = $row ["size"];

    $quantity = $row ['quantity'];

    $protection = $row ['protection'];

    $location = $row ["location"];

    $sublocation = $row ["secondary"];

    $bc = $row ["BC"];

    $id = $row ['id'];

    ? >

    <! doctype html >

    < html >

    < link href = "stylesheets/main_stylesheet.css" rel = "stylesheet" type = "text/css" > "

    < link href =' http://fonts.googleapis.com/CSS?family=slabo+27px ' rel = "stylesheet" type = "text/css" >

    <! - Favicon - >

    < link rel = "shortcut icon" type = "image/png" href = "images/icon.png" / > "

    < style type = "text/css" >

    < / style >

    < head >

    < meta charset = "utf-8" >

    < title > list of < /title > printing equipment

    < link href = "stylesheets/print_stylesheet.css" rel = "stylesheet" type = "text/css" > "

    < script src = "sorttable.js" > < / script >

    <!-< onload = "window.print () of body" >-> ""

    < / head >

    < body >

    < div class = "non-print print_button" onClick = "window.print ()" > print < / div >

    < div class = 'print_text non-print' > select the sort the list by clicking on the categories of the table, and then click Print below < / div >

    < div class = "print_a4page" >

    < div class = "print_header" >

    < div class = "print_header_logo" > < img src = "images/logo.png" width = "306" height = "43" > < / div > "

    < div class = "print_header_text" id = "header_text" > Drama Database < / div >

    < div class = "print_header_info" > printout: < script type = "text/javascript" >

    var currentTime = new Date();

    var month = currentTime.getMonth () + 1;

    var day = currentTime.getDate ();

    year = var currentTime.getFullYear ();

    document. Write (day + "/" + month + "/" + year); < /script >

    < br >

    Total records:

    <? PHP echo $row_count? > < / div >

    < / div >

    < div class = "print_header_divider" > list of equipment < / div >

    < div class = "print_body" >

    < div >

    < name of the form = 'users' method = "post" >

    < div class = "table_print" >

    < table width = "100%" border = "0" cellpadding = "5" class = "sortable" >

    < class tr = "table_header_print" >

    < th = "15%" scope = "col" width > name < /th >

    < th = "12%" scope = "col" width > size < /th >

    < th = "9%" scope = "col" width > quantity < /th >

    < th = "12%" scope = "col" width > Protection < /th >

    < th = "17%" scope = "col" width > location < /th >

    < th = "12%" scope = "col" width > secondary < /th >

    < th = "11%" scope = "col" width > Barcode < /th >

    < th = "12%" scope = "col" width > Internal ID < /th >

    < /tr >

    <? PHP {? >}

    < class tr = "table_body" >

    < td > <? PHP echo $name? > < table >

    < td > <? PHP echo $size? > < table >

    < td > <? PHP echo $quantity? > < table >

    < td > <? PHP echo $protection? > < table >

    < td > <? PHP echo $location? > < table >

    < td > <? PHP echo $sublocation? > < table >

    < td > <? PHP echo $bc? > < table >

    < td > <? PHP echo $id? > < table >

    < /tr >

    <? PHP} while ($row = mysqli_fetch_assoc ($query));? >

    < /table >

    < / make >

    < / div >

    < / div >

    < / div >

    < / body >

    < / html >

    You assign row values to variables outside the loop if of course they never change! Make the way Ben tells you.

  • Need help with a query MySQL =)

    The following query displays the arguments in the order of how many times that each bid was seen by a visitor in the last 7 days, from the highest to the lowest. How can I show him each record in the table 'submission_data', even if there is no matching record in the table 'submission_views '? Basically I want the presentations with a 'id_count' of 0 to display at the end.

    SELECT COUNT (Distinct submission_views.submission_id, submission_views.ip_address) AS id_count, submission_data.id, submission_data.thumbnail_source, submission_data.title, submission_data.type
    FROM submission_data LEFT JOIN submission_views ON submission_views.submission_id = submission_data.id
    WHERE submission_views.timestamp > DATE_SUB (NOW (), INTERVAL of 7 DAYS)
    GROUP BY submission_data.id
    ORDER BY id_count DESC

    > WHERE (submission_views.timestamp > DATE_SUB (NOW (), INTERVAL of 7 DAYS))
    (> OR submission_views.timestamp = NULL)

    Use the IS NULL, not the = operator.

  • correct to write this query mysql syntax?

    Hello

    Help to write a mysql should question that I don't have the knowledge to do so.

    I have 2 tables, say table1 and table2.  I want to take (status) column data in table 1 and replace what is in the (state_id) column in table 2.

    Notes:

    The column names do not match.

    I can match the user ID unique from table1 to table2, these are the same.

    I want only to replace data in a few columns, not the entire table, other data must remain unchanged.

    I want to m data in the tables themselves from one to the other, not only compiled as a result of a mysql query.

    Wasn't sure if I should use a merger?  tried several ways but without success.

    any person in charge to write something that I can use?  I'm sure its easy to write, I just can't write advanced queries on top of my head like that :-)

    Okay, it looks like that MySQL does not support the FROM clause in the update instructions. Use a join:

    http://www.electrictoolbox.com/article/MySQL/cross-table-update/

  • query MySQL returns a different number of records of coldfusion and navicat

    Hello

    I hope someone can suggest a basic strategy to debug it.

    I have a fairly large and complex question that is run by a function in a cfc.

    (For example), it returns 100 rows.

    If I use cfdump and then copy and paste the SQL of the query (with variables, of course) in Navicat and run exactly the same query on the same mySQL database, it returns 130 lines.

    Even string SQL, the same database, same data - the only difference is that in one instance Navicat submits the request and in the other, Coldfusion doesn't.

    Has anyone already had something like this happen before?

    OK I found the bug mine. Of * course * sql queries were not identical... they might not. My mistake was thinking that they were.

    The problem was part of the WHERE clause:

    AND orderid in (500,503,505)

    In the coldfusion code, it was

    AND orderid in ()

    which of course made in mySQL like AND orderid in ('500,503,505')

    It was not immediately obvious that the cfdump that returns in the form AND orderid in (?) with the variable in the table below.

  • help query rewrite

    Hello

    could you help me rewrite the query without using joins

    Select * from A, B, C
    LEFT OUTER JOIN
    WE (A.account_no = B.account_no
    AND C.id_type = B.id_type
    AND B.value = 1);


    Thank you
    -Raj

    Select * from A, B, C
    WHERE A.account_no = B.account_no (+)
    AND C.id_type = B.id_type
    AND B.value = 1;

  • Query MySQL do not appear

    I'm building a query simple db using MAMP - PHP/MySQL and have managed to access the DB and am able to query the DB compared to the breast of Recordset links. I have the defined query to locate an ID locator and then go back and see the other two fields - name and expiration date. I am using a configuration of php SUBMIT pointing to a PHP file configured to display results. If I enter an ID (which I know is here) the result window opens to display an empty field.

    Here's the code for subnmit:

    <? php require_once('.. / Connections/Test999.php');? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via 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 "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }

    $editFormAction = $_SERVER ['PHP_SELF'];

    If (isset {}

    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);

    }

    If ((isset($_POST["MM_update"])) & & ($_POST ["MM_update"] == "form1")) {}

    $updateSQL = sprintf ("UPDATE tblPatients SET name = %s, posted = %s, PatientID = %s WHERE idtblPatients = %s",

    GetSQLValueString ($_POST ['name'], "text").

    GetSQLValueString ($_POST ["' show"], "date").

    GetSQLValueString ($_POST ["'PatientID"], "text").

    GetSQLValueString ($_POST ['idtblPatients'], "int"));

    @mysql_select_db ($database_Test999, $Test999);

    $Result1 = mysql_query ($updateSQL, $Test999) or die (mysql_error ());

    }

    @mysql_select_db ($database_Test999, $Test999);

    $query_Recordset1 = "SELECT * FROM tblPatients";

    $Recordset1 = mysql_query ($query_Recordset1, $Test999) or die (mysql_error ());

    $row_Recordset1 = mysql_fetch_assoc ($Recordset1);

    $totalRows_Recordset1 = mysql_num_rows ($Recordset1);

    # FileName = "Connection_php_mysql.htm"

    # Type = 'MYSQL '.

    # HTTP = 'true '.

    $hostname_Test999 = "localhost";

    $database_Test999 = "xediTHM";

    $username_Test999 = 'root ';

    $password_Test999 = 'root ';

    $Test999 = mysql_pconnect ($hostname_Test999, $username_Test999, $password_Test999) or trigger_error (mysql_error (), E_USER_ERROR);

    mysql_free_result ($Recordset1);

    ? >

    < do action = "<?" PHP echo $editFormAction;? ">" method = "post" name = "form1" id = "form1" >

    < table align = "center" >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > IdtblPatients: < table >

    < td > <? PHP echo $row_Recordset1 ["idtblPatients"];? > < table >

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > name: < table >

    < td > < input type = "text" name = "Name" value = "<?" PHP echo htmlentities ($row_Recordset1 ['name'], ENT_COMPAT, ");? ">" size = "32" / > < table >

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > displayed: < table >

    < td > < input type = "text" name = "Posted" value = "<?" PHP echo htmlentities ($row_Recordset1 ['display'], ENT_COMPAT, ");? ">" size = "32" / > < table >

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > PatientID: < table >

    < td > < input type = "text" name = "PatientID" value = "<?" PHP echo htmlentities ($row_Recordset1 ['PatientID'], ENT_COMPAT, ");? ">" size = "32" / > < table >

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > < table >

    < td > < input type = "submit" value = "Update file" / > < table >

    < /tr >

    < /table >

    < input type = "hidden" name = "MM_update" value = "form1" / >

    < input type = "hidden" name = "idtblPatients" value = "<?" PHP echo $row_Recordset1 ["idtblPatients"];? ">" / >

    < / make >

    < p > < / p >

    Here is the code of the page of query results:

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "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 > validate < /title >

    < style type = "text/css" >

    {body

    background-color: #09F;

    }

    < / style >

    < / head >

    < body >

    < table width = "386" border = "1" >

    < b >

    Name < td > < table >

    posted < td > < table >

    < /tr >

    <? PHP {? >}

    < b >

    < height td = "39" > <? PHP echo $row_Recordset88 ['name'];? > < table >

    < td > <? PHP echo $row_Recordset88 ['display'];? > < table >

    < /tr >

    <? PHP} while ($row_Recordset88 = mysql_fetch_array ($Recordset88));? >

    < /table >

    < / body >

    < / html >

    <? PHP

    mysql_free_result ($Recordset88);

    ? >

    <? php require_once('Connections/Test999.php');? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via 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 "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }

    $maxRows_Recordset88 = 2;

    $pageNum_Recordset88 = 0;

    If (isset($_GET['pageNum_Recordset88'])) {}

    $pageNum_Recordset88 = $_GET ['pageNum_Recordset88'];

    }

    $startRow_Recordset88 = $pageNum_Recordset88 * $maxRows_Recordset88;

    $colname_Recordset88 = "-1";

    If (isset($_GET['PatientID'])) {}

    $colname_Recordset88 = $_GET ["PatientID"];

    }

    @mysql_select_db ($database_Test999, $Test999);

    $query_Recordset88 = sprintf ("" SELECT name, showed WHERE the PatientID = %s tblPatients ", GetSQLValueString ($colname_Recordset88,"text")");

    $query_limit_Recordset88 = sprintf ("%s LIMIT %d, %d", $query_Recordset88, $startRow_Recordset88, $maxRows_Recordset88);

    $Recordset88 = mysql_query ($query_limit_Recordset88, $Test999) or die (mysql_error ());

    $row_Recordset88 = mysql_fetch_array ($Recordset88);

    If (isset($_GET['totalRows_Recordset88'])) {}

    $totalRows_Recordset88 = $_GET ['totalRows_Recordset88'];

    } else {}

    $all_Recordset88 = mysql_query ($query_Recordset88);

    $totalRows_Recordset88 = mysql_num_rows ($all_Recordset88);

    }

    $totalPages_Recordset88 = ceil($totalRows_Recordset88/$maxRows_Recordset88)-1;

    ? >

    -------------

    What is shown is without name and date.

    Dreamweaver1.png

    I'm new to PHP/MySQL any ideas where I made a blunder would be most appreciated.

    Thank you

    Your form is by using the POST method, but you will recover the PatientID using GET. You must use the same method to send and receive.

  • Code help: query based cfloop with StartRowOptional and EndRowOptional in cfscript

    It is probably a fairly simple thing - but I'm trying to learn as much cfscript possible by converting my CFC cfscript. I found examples of loops in cfscript based on a query, but I don't know where the StartRowOptional and EndRowOptional would fit in.

    < cfloop query = StartRowOptional "qQuery" = "start #" EndRowOptional = "#end #" >

    < cfset var = var1 >

    < cfset var2 = var2 >

    < / cfloop >

    Thanks a bunch for advice.

    ~ Ben

    You should be able to use a 'for' with indexes and keys. Something like (where 'start' and 'end' is your values):

    Loop over the query.

    for (intCurrentRow = start; end LTE intCurrentRow; intCurrentRow = (intCurrentRow + 1))

    {

    access the query as if it were a structure of arrays with the index of the current line:

    stcSongs.songID = qSongs ["songID'] [intCurrentRow];

    stcSongs.songName = qSongs ['songName'] [intCurrentRow];

    etc...

    }

    Hope that helps.

  • Need help query subquery

    Hey guys,.
    I have a question that I can't wrap my head around. I have a table called traffic, and in this table I have tons of columns... I focus mainly on three pillars, VIOLATIONTYPE, TID, AND guid. When a judgment is made, it receives a uniqueIdm which is the GUID column.
    If more than one ticket is given to the individual, the guid remains the same. I need to write a query to find out how many warnings is emitted by the user who is TID column.
    The problem is, if more than one ticket has been assigned at the time of the stop and these tickets are not only attention, but also a quote, I won't count that stops traffic in my query.
    I just need all the stops that are strictly warnings.
    Of course, I know how to extract the warnings, but if the guid is a warning and reference both, I don't know how to remove the records in the query. Any help would be appreciated. The query below, I wrote is just the initial steps to get * him to stop before I eliminate records where a quote and a caveat had the same GUID...

    Select * from traffic where tid = "1234" and violationtype = "warning" and guid in (select traffic seq_guid b where a.guid = b.guid)

    Consider using a NOT IN or NOT EXISTS a subquery to allow lines with citations, something like (not tested)

    select *
      from traffic a
     where tid='1234'
        and violationtype = 'warning'
        and guid in (select seq_guid from traffic b where a.guid = b.guid)
        and not exists (select 0 from traffic c where c.guid = a.guid and violation_type = 'citation')
    
  • Need help query view with the 'Level' column name

    Hello world

    I use Oracle DB 10 g

    I have this request
    SELECT  count(per_id) 
    FROM    XXITS_EMP_MSTR_V
    WHERE   per_id = 213214 
    AND     Level='Technical Staff / Officer'
    XXITS_EMP_MSTR_V is a view created by someone else.

    I get the error "ORA-01788: CONNECT BY clause in this query block" for the the above statement.
    Is it possible that I can always get the result without changing the view?

    Any help is appreciated...

    Thank you
    Elmer

    Elmer says:
    Hello world

    I use Oracle DB 10 g

    I have this request

    SELECT  count(per_id)
    FROM    XXITS_EMP_MSTR_V
    WHERE   per_id = 213214
    AND     Level='Technical Staff / Officer'
    

    Place the level with quotes

    AND "Level" = 'Technical Staff / Officer'
    

    Make sure that the case is used correctly when using double quotes.

  • Help - query on the XMLType column?

    Hello

    Please could someone help me to write a query to extract data from XMLType column in the script below:

    Here is my example of WHAT XML stored in the XMLType column:
     <?xml version="1.0" encoding="UTF-8"?>
    <cf:IncidentReportGroup xmlns:cf="http://xml.crossflo.com/jxdm/3.0.3"
    xmlns:j="http://www.it.ojp.gov/jxdm/3.0.3" xmlns:ext="http://xml.crossflo.com/jxdm/3.0.3/extension"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:i="http://www.it.ojp.gov/jxdm/appinfo/1">
        <cf:IncidentReport>
            <ext:Incident>
                <j:ActivityID>
                    <j:ID>99999999999999</j:ID>
                </j:ActivityID>
                <j:ActivityDate>2007-01-13</j:ActivityDate>
                <j:ActivityTime>01:25:00Z</j:ActivityTime>
            </ext:Incident>
        </cf:IncidentReport>
    </cf:IncidentReportGroup>
    I want to retrieve ActivityDate and ActivityTime where ActivityID/ID = 'something'...

    Here is the example query I wrote but no luck:
    SELECT extractValue(xml_doc, '/cf:IncidentReport/ext:Incident/j:ActivityDate','/cf:IncidentReport/ext:Incident/j:ActivityTime')
      FROM TABLEA 
      where existsNode(xml_doc,'/cf:IncidentReport/ext:Incident/j:ActivityID[j:ID="99999999999999"]')
     
    SQL>  var ID varchar2(20)
    
    SQL>  exec :ID := '99999999999999'
    PL/SQL procedure successfully completed.
    
    SQL>  with t as (
     select xmltype('
    
        
            
                
                    99999999999999
                
                2007-01-13
                01:25:00Z
            
        
    ') xml from dual
    )
    select t2.*
      from t t, xmltable(xmlnamespaces('http://xml.crossflo.com/jxdm/3.0.3/extension' as "ext",
                                       'http://www.it.ojp.gov/jxdm/3.0.3' as "j"),
                         'ext:Incident[j:ActivityID/j:ID=$ID]'
                         passing t.xml.extract('//ext:Incident','xmlns:ext="http://xml.crossflo.com/jxdm/3.0.3/extension"'),
                                 xmlelement(ID, :ID) as ID
                         columns ActivityID   varchar2(10) path 'j:ActivityID',
                                 ActivityDate varchar2(10) path 'j:ActivityDate',
                                 ActivityTime varchar2(10) path 'j:ActivityTime') t2
    /
    ACTIVITYID ACTIVITYDA ACTIVITYTI
    ---------- ---------- ----------
    9999999999 2007-01-13 01:25:00Z
    1 row selected.
    

    Published by: michaels2 on March 2, 2009 08:43

  • many need help query step

    Hi I met a problem while making this request.

    I'm doing the query shows how many customers entered into a table of rental during the set time that I choose.

    I am tempted to cross reference it with the amount of customers stored in the original customer table since the beginning of time.

    That's what I came with, but I get the error that I have successfully completed my Sql

    SELECT * FROM RENTAL WHERE RENTAL_DATE > = 1 January 14 ' AND RENTAL_DATE < = 10 January 14 ',.

    COUNT (DISTINCT CUST_ID) AS NUMBEROFCUSTOMERS,

    SELECT COUNT (DISTINCT CUST_ID) AS TOTALCUSTOMERS CUSTOMER

    The top and the bottom of line work separately from this, but when I add the line in the Middle I have no chance.

    Thanks in advance

    First of all, ' 01-JAB-14' is not a date - it's a chain. Anyway, you can use an outer join:

    SELECT COUNT (DISTINCT C.CUST_ID) DID TOTALCUSTOMERS,

    COUNT (DISTINCT R.CUST_ID) AS TOTALRENTERS

    CUSTOMER C,.

    RENTAL R

    WHERE C.CUST_ID = R.CUST_ID (+)

    AND R.RENTAL_DATE (+) > = DATE ' 2014-01-01'

    AND RENTAL_DATE (+)<= date="">

    /

    Or:

    SELECT COUNT (CUST_ID) AS TOTALCUSTOMERS.

    MAX)

    (

    SELECT COUNT (DISTINCT CUST_ID)

    RENTALS

    WHERE RENTAL_DATE > = DATE ' 2014-01-01'

    AND RENTAL_DATE<= date="">

    )

    ) AS TOTALRENTERS

    OF THE CUSTOMER

    /

    SY.

  • Please Help: query the value of the WHERE clause string

    Hello world
    I try the customers request that has corresponding name, but I get the result of every customer that has the name and surname. Here is my query:
    SELECT * FROM  CUSTOMERS WHERE
     CUSTOMER_FNAME IN
     (
     'JOHN', 'MIKE'
     )
    AND CUSTOMER_LNAME IN
     (
     'DOE', 'MILLER'
     ); 
    I am trying to query customer name JOHN DOE and MIKE MILLER, but I get the results of all names with the names of first/last is not exact match. Is there a way I can get the exact match?


    Thank you
    SM

    Something like

    SQL> -- generating sample data:
    SQL> with customers as (
      2  select  'JOHN' fname, 'DOE' lname from dual union
      3  select  'JO' fname, 'HNDOE' lname from dual union
      4  select  'MIKE' fname, 'DOE' lname from dual union
      5  select  'JOHN' fname, 'MILLER' lname from dual union
      6  select  'MIKE' fname, 'MILLER' lname from dual
      7  )
      8  --
      9  -- actual query:
     10  --
     11  select *
     12  from   customers
     13  where  fname||'~'||lname in ('JOHN~DOE', 'MIKE~MILLER');
    
    FNAM LNAME
    ---- ------
    JOHN DOE
    MIKE MILLER
    
    2 rows selected.
    

    but it's just a way, there is more...

    Published by: Hoek on 2 April 2013 18:20 example change changed, thanks to Frank and APC to report that I really need a break now ;)

  • Query MySQL or the CF code to 'Flag' a group of results from a query based on a common value?

    I have the following query that examines customer accounts:

    SELECT    ACCOUNT_ID, SUBSCRIBER_ID, PKG_CODE    
    FROM   Accounts   
    WHERE  ACCOUNT_DESC LIKE '%Eye%'   
    GROUP BY  ACCOUNT_ID

    Gives me the following result...

     1. ACCOUNT_ID,  SUBSCRIBER_ID, PKG_CODE  
    2. ---------- -------------- -------   
    3. 11016869,    10016598,      N 
    4. 11015922,    10015713,      N 
    5. 11015062,    10014878,      N 
    6. 11018312,    10017973,      Y 
    7. 11018310,    10017973,      N 
    8. 11018309,    10017973,      N 
    9. 11018308,    10017973,      N

    Question: How can I display a '1' in a column of flag if 'someone' of the 'SUBSCRIBER_ID' have a "O" value in the PKG_CODE column?

    Here are the results of the query that I'm trying to do for this example (note that the last 4 reviews should be marked with a '1' because one of them had a 'Y' for PKG_CODE and SUBSCRIBER_ID correspondent...)

    1. ACCOUNT_ID, SUBSCRIBER_ID, PKG_CODE, FLAG
    2. ---------- -------------- ------- -----
    3. 11016869,10016598, N
    4. 11015922,10015713, N
    5. 11015062,10014878, N
    6. 11018312,10017973, Y, 1
    7. 11018310,10017973, N-1
    8. 11018309,10017973, N-1
    9. 11018308,10017973, N-1

    I tried the following, but it only reports the recordings of 'Y '? I need to check also the SUBSCRIBER_ID' column value...

    SELECT    ACCOUNT_ID, SUBSCRIBER_ID, PKG_CODE  
    , IF(PKG_CODE = 'Y', "Y", "N") AS FLAG   
    FROM   Accounts   
    WHERE  ACCOUNT_DESC LIKE '%Eye%'   
    GROUP BY  ACCOUNT_ID

    If this can be done on the page of the CF, which would work as well instead of in the query... I just need the Flagged values to display next to each record.

    SELECT ACCOUNT_ID, SUBSCRIBER_ID, PKG_CODE, IF(SUBSCRIBER_ID IN)

    (SELECT SUBSCRIBER_ID

    Accounts

    WHERE ACCOUNT_DESC LIKE '% eyes %' AND PKG_CODE = 'Y'), 1, 0) AS flag

    Accounts

    WHERE ACCOUNT_DESC LIKE '% % eyes '.

    ACCOUNT_ID GROUP

Maybe you are looking for