Beginner: Getting syntax error on WHERE clause in SELECT

I'm very new to php and mySQL.  Am using DW master/detail to generate to basic code I need.  One thing I need to do is modify a select statement in the master to include a WHERE clause to limit the selection to a particular value in one field.
I'm getting a syntax error with the WHERE clause I'm adding to the map select statement.
This is the portion of the error message showing the error location:
'WHERE Group='Community' LIMIT 0, 10'
The php that generated the select is:
$query_maps = "SELECT * FROM tblmaps ORDER BY tblmaps.DispSeq";
$query_limit_maps = sprintf("%s WHERE Group='%s' LIMIT %d, %d", $query_maps, $selectGroup, $startRow_maps, $maxRows_maps);
This approach to creating the select statement is from the code generated for the master page.  It adds the LIMIT clause.  All I did was add the "WHERE Group='%s' and the $selectGroup variable which comes from earlier code.  You can see that the $selectGroup variable is equal to the "Community: group.
I've scanned the web to see what syntax error I might be making but haven't found anything that explains it.
The full resolved select statement is:
SELECT * FROM tblmaps ORDER BY tblmaps.DispSeq WHERE Group='Community' LIMIT 0,10
What am I not seeing?
Tom

Thanks.  Make sense but changing that didn't help.
Here's the error message I'm getting:
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 'Group='Community' ORDER BY tblmaps.DispSeq LIMIT 0, 10' at line 1
The full select (from a debugging ECHO I inserted) is:
SELECT * FROM tblmaps WHERE Group='Community' ORDER BY tblmaps.DispSeq LIMIT 0, 10
Note that when I take the WHERE clause out, there is no syntax error.

Similar Messages

  • DATAMOVER: Error: Syntax error in where clause for PSOPRDEFN

    SET LOG C:\PSUSER_HRM.log;
    SET input F:\psoprdefn.dat;
    IMPORT psoprdefn where OPRId = 'PS';
    when i execute this command after importing .dat file from my database i get error:
    Error: Syntax error in where clause for PSOPRDEFN
    any suggestions pls help....
    Thanks
    aravind
    Edited by: 967641 on Nov 20, 2012 11:39 AM
    Edited by: 967641 on Nov 20, 2012 11:40 AM

    That is correct.
    Datamover tries to insert data in PSOPRDEFN and rows exist with these keys.
    To avoid this you can add the following statement in your script:
    SET UPDATE_DUPS;
    This will update the values other than the keys if a row already exists in the database with the keys in the dat file.
    I can advice you to buy the new book of Jim Marion, PeopleSoft PeopleTools Data Management and Upgrade Handbook
    http://www.amazon.com/PeopleSoft-PeopleTools-Management-Upgrade-Handbook/dp/0071787925/ref=sr_1_1?ie=UTF8&qid=1353575734&sr=8-1&keywords=jim+j+marion
    It has an entire chapter on how to use datamover.
    Hakan

  • Syntax error in WHERE clause

    Hi all,
    see the code.
    data: itab type cdhdr occurs 0,
            wa type cdhdr.
    data: begin of itab1 occurs 0,
             lifnr like lfa1-lifnr,
              ktokk like lfa1-ktokk,
            end of itab1.
    select * from cdhdr into table itab.
    select lifnr ktokk from lfa1 into table itab1
        for all entries in itab
          where lifnr = itab-objectid.
    when i go for Syntax check i am getting Error like  " when using the addition for all entries in itab " the fields  LIFNR and ITAB-OBJECTID  must have the same type and lengh.
    so, i have done the following correction in WHERE clause.
    select lifnr ktokk from lfa1 into table itab1
        for all entries in itab
          where lifnr = itab-objectid(10).
    But this time i am geting warning in German language.
    my correction is correct or not ?
    Pls guide me ..
    Thanks
    Krupali.

    select lifnr ktokk from lfa1 into table itab1
    for all entries in itab
    where lifnr = itab-objectid(10).
    But this time i am geting warning in German language.
    my correction is correct or not ?
    Answer is your correction is not correct.
    we cannot use offset with for all entries.
    you can do this way first take the itab-objectid(10) in some other field like temp than fire for all entries on temp.
    like below.
    select lifnr ktokk from lfa1 into table itab1
    for all entries in itab
    where lifnr = itab-temp."<-- see here
    Amit.
    Edited by: Amit Gujargoud on Aug 26, 2008 8:00 AM

  • Stupid question: whats wrong here? -- Syntax Error in FROM clause

    i keep getting the error: Syntax Error in FROM clause.
    here is the code:
    <%@ page import="java.sql.*" %>
    <HTML>
    <HEAD>
         <TITLE>User Application Area</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:fypproject","","");
    Statement st = con.createStatement();
    String email = (String)session.getAttribute("email");
    String levelStatus = (String)session.getAttribute("levelStatus");
    String details = "SELECT PD.Forename, PD.Surname, L.Level_Name FROM PD Personal_Details AND LD Login_Details AND L Level WHERE PD.Email_Address = LD.Email_Address AND LD.Level_ID = L.Level_ID AND Level_ID = '" + levelStatus + "'";
    ResultSet rsDet = st.executeQuery(details);
    if(rsDet.next()) {
    String forename = rsDet.getString("Forename");
    String surname = rsDet.getString("Surname");
    String level_name = rsDet.getString("Level_Name");
    %>
    <DIV ALIGN="center"><H1>User Application Arena</H1></DIV>
    <BR>
    <H4>Welcome back <% out.println(forename + " " + surname); %> </H4>
    <BR>
    <%
    out.println(level_name);
    else {
    out.println("NOT FOUND ANYTHING");
    st.close();
    con.close();
    %>
    </BODY>
    </HTML>
    the strange thing is when i write a query that doesn't involve the 'Level' table it works fine.
    for example if i just want to display the forename and surname from 'Personal_Details' where the Email_Address = email it works fine...as soon as i involve the 'Level' table i get this error.
    i basically have 'Level_ID' in the 'Login_Details' table which is found out in the preceding jsp and passed through to this page and i can print out the Level_ID
    but....what i want to do is use this Level_ID and find the respective Level_Name in the Level table.
    my Level table looks like this:
    Level_ID Level_Name
    0 Pending
    1 Interview
    2 Rejection
    Thanks :o)

    Perhaps this is your issue ...
    The column Level_ID is in both the Login_Details and Level tables. Therefore, in your WHERE clause, you must specify a table alias for each reference to Level_ID
    WHERE PD.Email_Address = LD.Email_Address AND LD.Level_ID = L.Level_ID AND Level_ID = '" + levelStatus + "'";
    should be
    WHERE PD.Email_Address = LD.Email_Address AND LD.Level_ID = L.Level_ID AND L.Level_ID = '" + levelStatus + "'"; //ADDED "L." before Level_ID
    Level_ID would have been unique until you added the Level table.
    Good luck.
    -Mark

  • Exception: DBD, [Microsoft][ODBC Excel Driver] Syntax error in FROM clause.

    Dear experts,
    I'm trying to create an universe linked to an Excel File.
    I've created the ODBc connection and the DNS Data Source and inserted the table (table name RAC$) in the Universe. however, when I try to map each table field in the universe's Objects I'm getting this error message:
    "Exception: DBD, [ODBC Excel Driver] Syntax error in FROM clause.State:37000".
    I've tried to rename the table, inserting square brackects and also add new parameters to the universe («Transactional Available = "Yes"» and «Delimited Identifier = "Yes"») but still no solution to my problem.
    Any advice, tip or trick?
    Thank you. My best regards.
    Inês Santos

    Hi Ines,
    Thanks for sharing how you resolved this! I will bookmark this so that I can find it when I will likely need it!
    Bill
    Sorry I don't know how to make the accent circumflex! Or is that what you call it? On top of the e?
    Edited by: wavery on Jun 11, 2010 12:07 AM
    Edited by: wavery on Jun 11, 2010 12:09 AM

  • Syntax error in From clause from Access

    I am trying to migrate a database from Access 2000, and all of the tables except one migrate correctly. The one problem table gives me the following error message:
    Unable to migrate table data: NWQ_TANC.PARAMETERS; [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
    Does anyone know how to fix this? I have found the error in the help Appendix, but it just lists it as a QUERY type error, #3131, and gives no explanation or clues on how to fix it.
    Thanks, Jessica

    Hi Jessica
    Just wondering if you ever managed to find a solution to this problem, as I am getting a very similar error - only I don't just get it for one table, I get it for every single table in the database!
    Would be very interested to hear if you managed to sort it or not
    Cheers
    Ed

  • Getting syntax error in "SAPLBBP_PDH_CUF" in shopping cart/RFx/PO creation process in SRM7.0.Is it Patch issue?

    Getting syntax error in "SAPLBBP_PDH_CUF" in shopping cart/RFx/PO creation process in SRM7.0.Is it Patch issue?

    Hi, something wrong with your customer fields...
    Please, check them...

  • Problem: Error in WHERE clause. Unrecognized clause or element.

    Hi All,
    i have a replicat and tried to filter some rows:
    This was my MAP-Statement in the param-file:
    MAP GOMS3KT, TARGET goldengate.txlog,
    COLMAP (
    tsid = #IDTIMESTAMP(),
    syskey = SYSKEY,
    type = "KT",
    trxtimestamp = #TRAILJULIANTS(),
    acquirer = #ACQFILTER(acq-id-schema_1,acquirer-id_1,log-item-length_2),
    origin = #ASSERTDEFAULT2(bezugssystem_1 ," " ,log-item-length_2),
    issuer = #MANIPULATEISSUER(bezugssystem_1, ISS-ID-SCHEMA_1, ISSUER-ID_1, -1, log-item-length_2)
    ) where (bezugssystem_1 = "PSVL");
    At runtime, i got this error:
    2013-02-25 09:09:42 WARNING OGG-00869 No unique key is defined for table 'TXLOG'. All viable columns will be used to represent the
    key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
    ...(bezugssystem_1 = "PSVL")...
    ^
    Error in WHERE clause. Unrecognized clause or element.
    The column 'bezugssystem_1' does exist, i mapped it before to a the oracle column 'origin'
    What is wrong here ??
    I i delete the where clause all works fine!
    Edited by: Felix_GG on 26.02.2013 15:44
    Edited by: Felix_GG on 26.02.2013 18:25

    Of course, in the where clause should stand a '=' or what i wrote (but is not able to show) the signs for NOT EQUAL, a 'less than' followed by a 'greater then'

  • I'm getting syntax error on a python instruction.  it looks good but crashes. (print "Odd",num) becomes (print ‚Äúodd ‚Äú, num) 70 72 69 6E 74 20 E2 80 9C 6F 64 64 20 E2 80 9C 2C 20 6E 75 6D  I've rebooted and changed keyboard

    I’m getting syntax error on a python instruction.  it looks good but crashes. (print “Odd",num) becomes (print ‚Äúodd ‚Äú, num) 70 72 69 6E 74 20 E2 80 9C 6F 64 64 20 E2 80 9C 2C 20 6E 75 6D  I’ve rebooted and changed keyboard

    It worked when typed in from the command line.  Doesn't when its pasted in from Text Edit, rtf or txt. 

  • TX BDLS - Syntax error in program SBDLS21020100127145818 line SELECT SINGLE

    Hi All,
    I am in the process of configuring a QAS system taken from a copy of th production system, I am going into TX BDLS and getting the following error message Syntax error in program SBDLS21020100127145818 line SELECT SINGLE AWSYS FROM DFKKKO has anyone got any ideas about this issue?
    Thanks
    Jay

    Force manual activation in se11 this tables: (SE11 -> display -> menu 'table' -> actívate)
    DFKKKO
    DFKKCOLFILE_P_W
    DFKKMKO
    DFKKREP06
    DFKKREP06_S
    DFKKREP07
    DFKKREV06
    DFKKREV07
    Try again the BDLS.
    Regards.

  • WHERE clause in SELECT statement

    hi experts..
    i want to give 'OR' condition in the 'where' clause of 'SELECT' statement.
    is it possible?
    for examlpe..
    IF EXIDV2 IS NOT INITIAL.
       SELECT * FROM YSDT_SHIPLOAD
                INTO TABLE IG_SHIPLOAD
                WHERE EXIDV2 = EXIDV2 AND
                             VHILM = PC1 OR PC2 OR PC3.
    ENDIF.
    i want that VHILM should be one of those three.
    how can i do this?
    thanks..

    Hi ,
    its possible,
    Select * from ysdt_shipload int table ig_shipload where exidv2 = exidv2
                                                                            AND vhilm = pc1
                                                                            OR     vhilm = pc2
                                                                             OR   vhilm = pc3.
    OR
    Select * from ysdt_shipload int table ig_shipload where exidv2 = exidv2
                        AND (vhilm = pc1 or vhilm = pc2 or vhilm = pc3).
    Regards
    Arani Bhaskar
    Edited by: arani bhaskar on Mar 16, 2009 5:14 PM

  • Regarding  dynamically assigning the where clause to select query

    hi,
      Please send the code regarding how to dynamically assign the where clause to select query.
    thanks in advance

    SELECT <fileds>
            INTO TABLE itab
            FROM dbase
            WHERE  condition.

  • The to_date() error in where clause of proc code

    In a proc code, firstly I use "SELECT to_char(f_date_1, 'DDMONYY') into :char_date FROM TBL_1;" to get the value of f_date_1.
    Then I use "SELECT ID FROM TBL_2 WHERE f_date_2 = :char_date;" to get the value of ID according char_date.
    In table, the type of f_date_1 and f_date_2 is DATE.
    char_date is "char char_date[10]".
    My question is:
    1. If I use WHERE f_date_2 = to_date(:char_date, 'DDMONYY'), it will prompt: "-1861, ORA-01861: literal does not match format string".
    2. If I use WHERE f_date_2 = :char_date, it will work well.
    Since the type of f_date_2 is DATE and the type of char_date is CHAR, why does to_date(:char_date, 'DDMONYY') have problems?
    Thanks.

    I was not able to duplicate the error you got, but I did spot something that may be affecting your results:
    *Set up test table using HR.EMPLOYEES*
    create table TEST_DATE as
    select employee_id, last_name, hire_date
    from employees
    var char_date char(10)
    begin
    select to_char(hire_date,'DDMONYY') into :char_date
    from test_date
    where rownum = 1;
    end;
    *case 1*
    select *
    from test_date
    where hire_date = to_date(:char_date,'DDMONYY')
    *case 2*
    select *
    from test_date
    where hire_date = :char_date --> this assumes a implicit char to date conversionWhile I got case 2 to work, it assumes that the database is configured to recognize the character mask as a valid string format. If you tried running that query on a different database, this query may fail as well.
    To verify why case 1 may not have worked, do a quick check:
    select :char_date from dualIt is possible that you may have applied a different character mask between your first query:
    >
    SELECT to_char(f_date_1, 'DDMONYY') into :char_date FROM TBL_1;
    >
    and the WHERE clause of your second query:
    >
    WHERE f_date_2 = to_date(:char_date, 'DDMONYY')
    >
    RP

  • Getting syntax error while executing keyfigure routine BI 7.0

    Hello,
    I am writing a very simple keyfigure routine to calculate sales revune using sales quantity and sales price, I am getting error as follows
    - I am in 'Rules Details' screen and I have selected 'Routine' as the rule type. I enter the following code in routine
         RESULT = SOURCE_FIELDS_RULE-/BIC/IO_VB_QU *
         SOURCE_FIELDS_RULE-/BIC/IO_VB_PRC .
    - I hit the check button on the routine page, it says no syntax errors
    - Now I am back in the 'Rules Details' page and I hit the 'Check' button it gives me the following error
    Rule(target IO_VB_REV, group: Standard Group): Syntax error in routine
    Please tell me what is wrong. what should i check

    Hi Vaibhav,
    Here are the details
    - I am loading data from flatfile to an Infocube with 3 keyfigures: IO_VB_PRC (Sales Price) , IO_VB_QU (Sales Quantity), IO_VB_REV (Sales Revune). Getting values for IO_VB_QU and IO_Vb_PRC from flatfile and calculating for IO_VB_REV using routine
    - I created Transformations, and under  Rule Group: Standard Group box I see 'X' sign against 'IO_VB_REV' field, meaning not mapped to any datasource field
    - In rules detail screen, I add two source fields of Rule , IO_VB_QU and IO_VB_PRC. I see IO_VB_REV already added under 'Target fields of Rule' section
    - I then add the only following line to routine
    RESULT = SOURCE_FIELDS_RULE-/BIC/IO_VB_QU *    SOURCE_FIELDS_RULE-/BIC/IO_VB_PRC .
    Clicking on check button it gives no syntax error message. I save and exit back to Rule Details page.
    - I specify 'USD' as the Conversion Type and then click on check button it initially gives me 'Incorrect Input'  written in an information message box and then error that Syntax error in routine
    Let me know what is that I am missing
    Thanks for helping

  • Getting syntax error in Crystal Report Viewer

    The web application that I am supporting has reports that are presented through CR Viewer. The problem that I am facing is that if I pass a value to get the report, its giving the following error.
    The syntax of the value of prompt 'name_of_paramente_passing' is incorrect. Please check the syntax and try again.
    I am not getting this error if I run the same report through the actual Crystal report program.
    So when I pass 123.1 to the crystal web viewer it wont give me any trouble. But If I pass 123.1(a) , it throws that error.
    somehow the combination of pareanthesis and the alphabet is causing some trouble....
    Is this a bug or some other problem.?
    Version that I have:
    Crystal Report web Viewer Control 11.5
    Crystal Developer 11.0.0.1282
    Please reply if you have any work around for this.
    Thank you,
    Santhosh

    Thanks Mohammed. But our application is trying to pass a parameter which contains user data like section numbers....
    So when we pass the value 123.1(a) , here what is happening behind the scene of CR viewer
    webSource0.AddParameter "promptex-NAMEOFPARAMETER", "123.1%28a%29"
    and it throws up the error
    "The syntax of the value for prompt 'NAMEOFPARAMETER' is incorrect. Please correct the syntax and try again"
    I have no idea why it is throwing up this errror....

Maybe you are looking for

  • Error 2032 in communication between Flex Client and WCF

    Hi All, I'm trying to establish communication between Flex Client and WCF service. WCF service accepts gZip compressed data and returns gZip compressed results. So I used Flex ByteArray.compress() and ByteArray.uncompress() for this purpose. However,

  • Link between EKKO and RBKP

    Hi all, I'm new to this system and I was wondering if someone could tell me how can I link EKKO and RBKP? Thank you!

  • HP Laserjet 4000/vista - trouble printing

    I am at my wit's end. My printer as referenced above is out of warranty and I am now operating on Windows Vista. I keep getting a message that states that the job requires more memory than is available on this printer. This did not happen with my pre

  • Transformations for 0IC_C03

    Hi Guys, We are doing a new BI 7.0 implementation and we are on Support pak 13. In BW3.5,for the 0IC_C03(2lis_03_bf/um) cube we have lot of complicated update rules. As in BI 7.0 we are using transformations instead of Transfer/Update rules, how do i

  • Odd page flow error I must be missing something obvious

    Ok in another .jpf file I have this working fine but for some reason in this one it is not. I get the following error. Caught exception when evaluating expression "{actionForm.unitPrice}" with available binding contexts [actionForm, pageFlow, globalA