Error In MySQL Query With DATE_FORMAT

this produses an empty query when it shouldn't. I've made some error when using DATE_FORMAT and filtering by MONTH and YEAR but not sure how to fix it:
mysql_select_db($database_VALUATIONS, $VALUATIONS);
$query_valuations = sprintf("SELECT val_Trans_id, DATE_FORMAT(val_Date '%d-%m-%Y'), val_Company_Name, val_Company_Ref, val_Manufacturer, val_Model FROM valuations WHERE val_Company_Ref = %s AND MONTH(val_Date) =  %s AND YEAR(val_Date) =  %s ORDER BY val_Date DESC", GetSQLValueString($colname_valuations, "text"),GetSQLValueString($colname2_valuations, "text"),GetSQLValueString($colname3_valuations, "text"));
Thanks if anyone knows the answer ......

I think that works as you say but I still can't get it to work with WHERE clauses for month and year, this tst works:
<?php require_once('Connections/tallon_admin.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_tallon_admin, $tallon_admin);
$query_Recordset1 = "SELECT DATE_FORMAT(val_Date, '%d-%m-%Y') as Date, val_Company_Name FROM valuations";
$Recordset1 = mysql_query($query_Recordset1, $tallon_admin) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Web Site</title>
</head>
<body>
<?php echo $row_Recordset1['Date']; ?> <br>
<br>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($mysql);
?>
I just can't get it working with a where clause to filter by month, this example returns an empty query when it shouldn't - also tried MONTH(val_Date) = %s
<?php require_once('Connections/tallon_admin.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;
$colname_Recordset1 = "-1";
if (isset($_GET['month'])) {
  $colname_Recordset1 = $_GET['month'];
mysql_select_db($database_tallon_admin, $tallon_admin);
$query_Recordset1 = sprintf("SELECT DATE_FORMAT(val_Date, '%d-%m-%Y') as Date, val_Company_Name FROM valuations WHERE MONTH(Date) = %s", GetSQLValueString($colname_Recordset1, "date"));
$Recordset1 = mysql_query($query_Recordset1, $tallon_admin) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Web Site</title>
</head>
<body>
<?php echo $row_Recordset1['Date']; ?> <br>
<br>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($mysql);
?>

Similar Messages

  • Error executing a query with large result set

    Dear all,
    after executing a query which uses key figures with exception aggregation the BIA-server log (TrexIndexServerAlert_....trc) displays the following messages:
    2009-09-29 10:59:00.433 e QMediator    QueryMediator.cpp(00324) : 6952; Error executing physical plan: AttributeEngine: not enough memory.;in executor::Executor in cube: bwp_v_tl_c02
    2009-09-29 10:59:00.434 e SERVER_TRACE TRexApiSearch.cpp(05162) : IndexID: bwp_v_tl_c02, QueryMediator failed executing query, reason: Error executing physical plan: AttributeEngine: not enough memory.;in executor::Executor in cube: bwp_v_tl_c02
    --> Does anyone know what this message exactly means? - I fear that the BIA-Installation is running out of physical memory, but I appreciate any other opinion.
    - Package Wise Read (SAP Note 1157582) does not solve the problem as the error message is not: "AggregateCalculator returning out of memory with hash table size..."
    - To get an impression of the data amount I had a look at table RSDDSTAT_OLAP of a query with less amount of data:
       Selected rows      : 50.000.000 (Event 9011)
       Transferred rows :   4.800.000 (Event 9010)
    It is possible to calculate the number of cells retreived from one index by multiplying the number of records from table RSDDSTAT_OLAP by the number of key figures from the query. In my example it is only one key figure so 4.800.000 are passed to the analytical engine.
    --> Is there a possibility to find this figure in some kind of statistic table? This would be helpful for complex queries.
    I am looking forward to your replies,
    Best regards
    Bjoern

    Hi Björn,
    I recommend you to upgrade to rev 52 or 53. Rev. 49 is really stable but there are some bugs in it and if you use BW SP >= 17 you can use some features.
    Please refer to this thread , you shouldn't´t use more than 50% (the other 50% are for reporting) of your memory, therefor I have stolen this quote from Vitaliy:
    The idea is that data all together for all of your BIA Indexes does not consume more then 50% of total RAM of active blades (page memory cannot be counted!).
    The simpliest test is during a period when no one is using the accelerator, remove all indexes (including temporary) from main memory of the BWA, and then load all indexes for all InfoCubes into ain memory. Then check your RAM utilization.
    Regards,
    -Vitaliy
    Regards,
    Jens

  • Error while executing Query with Variable.

    Hi All,
    I have written a query to fetch values from some user tables and sap tables. The query is as below.
    select a.docentry,a.u_scname,e.block,e.[City],
    e.[Country], e.[State1],
    e.[StreetNo], e.[ZipCode],
    e.[Building], e.[Cellular],a.[U_WONo], a.[U_DocDate],
    a.[UserSign], b.[LineId], b.[U_Des],
    b.[u_SDes], b.[U_UoM],
    b.[U_Qty], b.[U_Rte],
    b.[U_Tamt], a.[U_PrjName], a.[u_WO_PB],
    a.[U_WO_UL], a.[U_WO_FC],
    a.[U_WO_PYT], a.[U_WO_COP],
    a.[U_WO_TRMT], a.[U_WO_DocSub],
    a.[U_WO_ADV], a.[U_WO_OCondition],
    a.[U_WO_PRPBY], a.[U_WO_RCMBY],e.[CntctPrsn],
    (T4.[WhsName]+ '-' + T4.[Street] +'-' + T4.[Block])  as 'Work Address ',
    T4.[Building], T4.[City],
    T4.[ZipCode], T4.[U_PMCNT],  T4.[WhsName], e.Taxid0
    from [@e360_owor] as a join [@e360_wor1] as b
    on a.docentry = b.docentry
    left outer join
    ( select c.cardname,d.TaxId0,d.Taxid1, c.block, c.[City],
    c.[Country], c.[State1],
    c.[StreetNo], c.[ZipCode],
    c.[Building], c.[Cellular], c.[CntctPrsn]  from ocrd
    as c  join crd7 as d  on  c.cardcode = d.cardcode 
      where d.TaxId0 is not <b>null</b> ) as e
    on
    a.U_SCName = e.CardName 
    left outer join OWHS T4 on T4.[WhsName] = a.[U_Prj]
    where
    a.U_WONo = '[%0]'
    In this code, when the variable is assigned to field U_WONo, then I get an error
    Must Specify A Table To Select From. Statement 'Service Contractors' (OCTR) (s)  could nto be prepared.
    But when the values for variables are hard coded, the query executes.
    I have been working on it from long time, but same error exists. Could anybody help resolve the same...
    I am using SAP B1 2007 B, patch level 15.
    Thanks in advance,
    Regards
    Rohan

    The error messages may be misleading. With complicated queries with parameter request I frequently saw references to service contract (or something other).
    Sometimes SBO does not manage correctly variables in complicated queries and there is a note about the workaround to solve the problem:[Note730960|https://websmp130.sap-ag.de/sap/bc/bsp/spn/sapnotes/index2.htm?numm=730960]

  • PHP+MySQL query with empty value

    Hi!
    Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP
    4.2.3.
    We had problem when a submitted value for 'regionID' in the
    submit page
    was left blank and the following error message appears in the
    result page:
    "You have an error in your SQL syntax. Check the manual that
    corresponds
    to your MySQL server version for the right syntax to use near
    'LIMIT 0,
    3' at line 1"
    The problem was solved by adding at the top of the page:
    <?php
    if (isset($_POST['regionID']) &&
    empty($_POST['regionID'])) {
    $_POST['regionID'] = '0';
    ?>
    How to change the above code to retrieve ALL records when an
    empty \
    blank value is submitted for 'regionID'?
    TIA
    Nanu

    bbgirl wrote:
    > Something I picked up at a PHP/MySQL seminar...
    $_REQUEST works in place of
    > either $_GET or $_POST. It basically means use either
    get or post. But it is
    > less precise because it can pick up either variable and
    has to think about the
    > request...
    I'm afraid you've picked up rather poor information.
    $_REQUEST relies on
    register_globals being turned on. Since register_globals is
    considered a
    major security risk, the default setting has been off since
    April 2002.
    Many hosting companies have turned register_globals on, in
    spite of the
    security problems, because so many poorly written scripts
    rely on it.
    The PHP development team has decided to resolve this security
    issue once
    and for all by removing register_globals from PHP 6.
    Forget $_REQUEST. Use $_POST and $_GET always. It's safer,
    and it's
    futureproof.
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • Error when executing Query with user date settings = mm/dd/yyyy

    Hi all,
    I created a remote cube with datasource = TCURR table with proper conversion of the date etc.
    The query on top of this remote cube works fine if my user date settings is set to dd.mm.yyyy
    But when a user in USA, with user date settings = mm/dd/yyyy, executes the same query, they get a message
    SYST: Date 31/05/2006 not expected.
    Message no. FGV004
    The input variable on the Query is on 0CALMONTH.
    This message appears immaterial of what calmonth input I give.
    has anyone encountered this error? if yes, what could be the solution please?
    thanks
    Emmanuel

    Hi,
    This is in regard to the user settings maintained in transaction /nsu3.Please follow the below link.
    http://web.mit.edu/sapr3/docs/webdocs/getstarted/gsSETTINGS.html
    You need to change the settings as required.
    Hope this helps.
    Thank you,
    Prem

  • Cl_rsr_chabit error while runing query with two new Nav attributes

    hi gurus,
    we mark two attributes as navigational and transport to production now the problem is when I run the query on those navigational attributes it is throwing me error as below:
    System error in programme CL_RSR_CHABIT and form SET_BITI-02(see long text)
    programme rror in class SAPMSSY1 method uncaughjt exception.
    and when I ran try to extract data on existing report from these attributes then it is showing me no data.Pls advice
    Thanks
    R

    Hello Michel,
    we faced exaclty the same problem today - re-activating the multiprovider solved the problem.
    Kind regards,
    Thomas

  • Error in select query with package size

    Hi Experts,
    I have an issue.
    SELECT * FROM (w_tab-tablename) I
    NTO CORRESPONDING FIELDS OF TABLE <lt_data> PACKAGE SIZE 10000.
    Am splitting the table for every 10000 records,for first time the select query is successful.
    But when it comes for the second 10000 records,its throwing the following dump.
    "DBIF_RSQL_INVALID_CURSOR"
    Help Appreciated

    Hi,
       There are a few instances where you get this error.
        1) If you are debugging inside select ... endselect.
        2) You have written any of the below statements inside select ... endselect.
    Please look at the dump .. you'll find the below ..
    MESSAGE (apart from MESSAGE S...)                                       
    COMMIT WORK                                                             
    ROLLBACK WORK                                                           
    BREAK-POINT                                                             
    WAIT                                                                    
    CALL FUNCTION ... DESTINATION (synchronous RFC)                         
    CALL FUNCTION ... STARTING NEW TASK                                     
    RECEIVE RESULTS                                                         
    CALL DIALOG                                                             
    CALL SELECTION-SCREEN                                                   
    CALL TRANSACTION                                                        
    CALL SCREEN, or any other statement that results in the display of a    
    new screen                                                              
    Regards,
    Srini.

  • Error when executing query with variables in excel

    When I execute a query in excel, it gives some errors if it has some variables (From Date, To Date etc):
    Error Specify a value for variable From Date
    Error Specify a value for variable To Date
    I need to execute the query and then save a view. I want to do this in excel as I am not able to save a view if I execute in a web browser.

    Hi Sanjeev.
    Of course Excel supports input of variable values.
    What version of BW/BI both backend and frontend are you using?
    Please check if you can execute the query in TA RSRT. You could try to generate the query again here.
    Hope it helps.
    BR
    Stefan

  • Syntax errors in update query with inner joins and sub query.

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....
    sp_CFQ_Coord_Corrections is a table and not a stored procedure.
    are these both tables "sp_CFQ_Coord_Corrections" and "CFQ_Coord_Corrections" different ??

  • Mysql query with duplicate results

    I have a db that someone else set up that I am querying. It
    should have been set up to use a couple of different tables... one
    for clients and one for subclients with foreign keys to identify.
    However, each row has both the client and subclient which means
    there are duplicate clients since a single client may have several
    subclients.
    So...
    My query returns multiple clients where I need only one. I am
    guessing I can handle this in a loop with AS2.0 but I can't figure
    out how to tell when a unique client is detected. Does this make
    sense? Do I need to set my query up differently?

    try {
    ResultSet rs = DB.exQuery("SELECT max(transaction_date) as lastest_date, transaction_value,transaction_type"
                                  + "FROM transaction_log WHERE user_id =" + user.getId() + " AND is_credit = '1'");
    if ( rs.next () ) {can you explain
    *     trans_date = rs.getString("lastest_date");* // trans_date is a string type or date type... and max(transaction_date) as lastest_date returns which type...
         credit = rs.getString("transaction_value");
         trans_method = rs.getString("transaction_type");
    } catch(SQLException ex) {}

  • MYSQL Query with Session Variable

    I would like to log in and after login success php will
    automatically query records using my username as the parameter.
    How can it be done in dreamweaver?
    How can I insert multiple values dependent on what I selected
    on a list/menu?
    Thank you!

    yeow Start by using PreparedStatement in your code.

  • Error in update query with join

    hi all,
    im using oracle 10g in windows.
    im not able to use this update query having join......
    UPDATE
    b
    SET
    b.is_stud = 1
    FROM
    boy b
    INNER JOIN
    relationship r
    ON
    b.id = r.boy_id;
    thanks a lot..................

    887268 wrote:
    hi, thanks,,,,,,,,,
    create table emp ( id,name,date,empno);
    create table emp_status(slno,ename,empno);
    i need to update "emp.name" in "emp" table from "emp_status.ename"
    where emp.empno=emp_status.empno;
    i.e) for all matched "empno" from both table, update "emp.name" from "emp_status.ename"Whats the relationship between emp and emp_status tables? If there exists one to one mapping for empno in both tables, then try
    update emp e
    set    e.name = (select es.ename
                     from   emp_status es
                     where  e.empno = es.empno)

  • Weird problem with mysql query and data table buttons !!!!

    Hi,
    I'm using jsc 2 update 1 on windows and mysql 4.1 . I have a page with a data table. One column of the data table contains "Details" buttons.
    Source query for the table is :
    SELECT tbl_tesserati.idtbl_tesserati idTesserato,
    tbl_tesserati.num_tessera,
    tbl_tesserati.nome,
    tbl_societa.codice_meccanografico
    FROM tbl_tesserati
    INNER JOIN tbl_rel_tesserato_discipline_societa ON tbl_tesserati.idtbl_tesserati = tbl_rel_tesserato_discipline_societa.id_tesserato
    INNER JOIN tbl_cariche ON      tbl_rel_tesserato_discipline_societa.id_carica = tbl_cariche.idtbl_cariche
    INNER JOIN tbl_qualifiche ON      tbl_rel_tesserato_discipline_societa.id_qualifica = tbl_qualifiche.idtbl_qualifiche
    INNER JOIN tbl_discipline ON      tbl_rel_tesserato_discipline_societa.id_disciplina = tbl_discipline.idtbl_discipline
    INNER JOIN tbl_societa ON      tbl_rel_tesserato_discipline_societa.id_societa = tbl_societa.idtbl_societa
    LEFT JOIN tbl_province ON tbl_societa.provincia_sede_sociale = tbl_province.idtbl_province
    LEFT JOIN tbl_comuni ON tbl_societa.comune_sede_sociale = tbl_comuni.idtbl_comuni
    LEFT JOIN tbl_rel_tesserato_discipline_praticate ON tbl_rel_tesserato_discipline_praticate.tessera_id=
    tbl_rel_tesserato_discipline_societa.idtbl_rel_tesserato_discipline
    LEFT JOIN tbl_discipline_praticate ON tbl_discipline_praticate.idtbl_disciplina_praticate=tbl_rel_tesserato_discipline_praticate.disciplina_praticata_id
    WHERE
    tbl_tesserati.cognome LIKE ?
    AND tbl_tesserati.nome LIKE ?
    AND tbl_rel_tesserato_discipline_societa.id_societa LIKE ?
    AND tbl_tesserati.idtbl_tesserati LIKE ?
    AND tbl_cariche.idtbl_cariche LIKE ?
    AND tbl_qualifiche.idtbl_qualifiche LIKE ?
    AND tbl_tesserati.data_nascita >= ?
    AND tbl_tesserati.data_nascita<= ?
    AND tbl_discipline.idtbl_discipline LIKE ?
    AND codice_affiliazione LIKE ?
    AND tbl_societa.denominazione LIKE ?
    AND YEAR(tbl_rel_tesserato_discipline_societa.data_scadenza) LIKE ?
    AND (tbl_province.nome LIKE ? OR tbl_province.nome IS NULL)
    AND ( tbl_comuni.nome LIKE ? OR tbl_comuni.nome IS NULL)
    The tbl_tesserati.data_nascita is a mysql date field.
    The click event handler code for the "Details" Button is:
    public String btnModificaTesserato_action() {
            try{
                TableRowDataProvider rowData= (TableRowDataProvider)getBean("currentRowTesserati");
                getRequestBean1().setId_tesserato((Long)rowData.getValue("idTesserato"));          
            } catch(Exception ex) {
                log("errore nella query",ex);
            return "dettaglioTesseratoSocieta";
        }When i run the project and open the page the table is correctly rendered and populated with some rows. But when i click on details button nothing happens, the page is simply reloaded.
    If i set a breakpoint in the code line   TableRowDataProvider rowData= (TableRowDataProvider)getBean("currentRowTesserati");the debbuger does not stop the code execution ! As if the button was never clicked!
    I tried to modify the source query to :
    SELECT tbl_tesserati.idtbl_tesserati idTesserato,
    tbl_tesserati.num_tessera,
    tbl_tesserati.nome,
    tbl_societa.codice_meccanografico
    FROM tbl_tesserati
    INNER JOIN tbl_rel_tesserato_discipline_societa ON tbl_tesserati.idtbl_tesserati = tbl_rel_tesserato_discipline_societa.id_tesserato
    INNER JOIN tbl_cariche ON      tbl_rel_tesserato_discipline_societa.id_carica = tbl_cariche.idtbl_cariche
    INNER JOIN tbl_qualifiche ON      tbl_rel_tesserato_discipline_societa.id_qualifica = tbl_qualifiche.idtbl_qualifiche
    INNER JOIN tbl_discipline ON      tbl_rel_tesserato_discipline_societa.id_disciplina = tbl_discipline.idtbl_discipline
    INNER JOIN tbl_societa ON      tbl_rel_tesserato_discipline_societa.id_societa = tbl_societa.idtbl_societa
    LEFT JOIN tbl_province ON tbl_societa.provincia_sede_sociale = tbl_province.idtbl_province
    LEFT JOIN tbl_comuni ON tbl_societa.comune_sede_sociale = tbl_comuni.idtbl_comuni
    LEFT JOIN tbl_rel_tesserato_discipline_praticate ON tbl_rel_tesserato_discipline_praticate.tessera_id=
    tbl_rel_tesserato_discipline_societa.idtbl_rel_tesserato_discipline
    LEFT JOIN tbl_discipline_praticate ON tbl_discipline_praticate.idtbl_disciplina_praticate=tbl_rel_tesserato_discipline_praticate.disciplina_praticata_id
    WHERE
    tbl_tesserati.cognome LIKE ?
    AND tbl_tesserati.nome LIKE ?
    AND tbl_rel_tesserato_discipline_societa.id_societa LIKE ?
    AND tbl_tesserati.idtbl_tesserati LIKE ?
    AND tbl_cariche.idtbl_cariche LIKE ?
    AND tbl_qualifiche.idtbl_qualifiche LIKE ?
    AND tbl_tesserati.data_nascita >= ?
    OR tbl_tesserati.data_nascita<= ?
    AND tbl_discipline.idtbl_discipline LIKE ?
    AND codice_affiliazione LIKE ?
    AND tbl_societa.denominazione LIKE ?
    AND YEAR(tbl_rel_tesserato_discipline_societa.data_scadenza) LIKE ?
    AND (tbl_province.nome LIKE ? OR tbl_province.nome IS NULL)
    AND ( tbl_comuni.nome LIKE ? OR tbl_comuni.nome IS NULL)
    Using this query everything works well !! The click handler works and the debugger too !!
    I changed only the AND in OR !!!
    I also tried to change mysql-x-x-connector driver but without solving my problem.
    Can someone help me ?
    Thanks
    Giorgio

    You'll find that it is more to do with the way MySql deals with dates than anything else! Depending on how your date field is setup, then try using a BETWEEN statement for those 2 lines in your first query e.g.
    AND ( tbl_tesserati.data_nascita BETWEEN ? AND ?)
    The date column needs to be in the ISO format to work. If you examine your second query output, you might discover that the output is only going to refer to one parameter (probably the OR one). Did you manage to view the output logs from the application server? You would have got an idea from there with a message like stating a conversion error'.
    Alternatively, you could try using the to_days() function and convert it directly to a number which would be a lot easier to deal with. For example:
    AND to_days(tbl_tesserati.data_nascita >= ? )
    AND to_days( tbl_tesserati.data_nascita<= ? )
    Or try the BETWEEN version with to_days() and see what you get.
    More info about date formatting (v5) here:
    http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_to-days
    Before I forget, sometimes you may need to treat dates as Strings rather 'Long' as you did.
    As a matter of interest, did you try your query in a different piece of software?
    If my queries are a little more complicated, I tend to try MySql queries out in the free MySql query browser and also double check in another to verify certain issues. I found it easier to develop SQL in a seperate program then import the final version to JSC making the required modifications for parameters.
    Message was edited by:
    aerostra

  • Error while trying to Execute the Query with Customer Exit

    Hi Experts,
           I am having a Query with Customer Exit, it is working fine for all the Employess, except for one. When i try to remove the Customer Exit it is working for her too. Below is the error i am getting.
    system error in program SAPLLRK0 and form RSRDR; CHECK_NAV_INIT_BACK
    Thanks,
    Kris.

    Hello Kris,
    Are you working with multiprovider? Please check if OSS notes 813454,840080 or 578948 are applicable in your case.
    Regards,
    Praveen

  • Error when opening a BW query with Crystal Reports

    Hi all,
    I am having problems when opening a BW query with Crystal Reports, the strange thing is that it only happens with
    the bo user I have created. If I use a user that already exists and that has SAP_ALL authorization it works.
    I don't know if this could be an authorizations issue, but I have created a role with all the authorizations stated in the manual.
    The error I am getting is the following:
    "An error occurred while generating a new report template. Error in UNKNOWN.RPT file"
    Does anyone know what this could be?
    Thanks

    Well,
    I cannot access the system now. But I think it is not an issue of authorization, because I assigned all the good user's role to the bo user,
    and even with that, it still don't work.
    Thanks

Maybe you are looking for

  • N95-8GB - Not able to connect in Data Transfer Mod...

    Hi all, Recently I bought N95-8GB and installed PC Suite which comes along with the phone in my OS Windows Vista Home Premium. When I try to connect my phone in Data Transfer mode, I am getting message "Found new hardware - Windows needs to install d

  • File transfer hung up on "Validating Device"

    I have added my husband's Vista PC - passkey exchanged - paired and connection on in control panel. He can send me files. When I try to send him something it hangs up on "validating device". He has his computer set to accept files. Any suggestions?

  • Images larger on TV

    Hi all, I burned two IMovie projects in iDVD. Everything is fine while played in the computer, but when I play the DVD in a common DVDplayer, images appear larger on TV and are cropped, I cannot see their outside and some text are hidden. What can be

  • PLEASE Quicktime component for AVI files?

    Trying to bring .AVI video files shot on Casio z750 over to Streamclip or at least START with QuickTime and THEN Streamclip so I can edit/burn family stuff in imovie/idvd.

  • My question about second INTERFACE DESIGN

    i create one interface( main interface created by JFRAME) in main interface i want to click button then create second interface. i should use which class to build second interface? i tried JFrame but it doesnot work JFrame is top cotainer .and it nee