Groups

    Whats Wrong with this SQL Statement...

    Im getting an error

    statement below.

    8 Comments

    Original Poster

    This is the statement

    MyStringBuilder.Append("SELECT tblHRData.EmployeeID AS ID, … MyStringBuilder.Append("SELECT tblHRData.EmployeeID AS ID, tblHRData.Title, tblHRData.Fname AS Firstname, ") MyStringBuilder.Append("tblHRData.Lname AS Surname, tblJobTitle.JobTitle") MyStringBuilder.Append("FROM (tblHRData INNER JOIN tblJobTitle ON tblHRData.JobID = tblJobTitle.JobID)") MyStringBuilder.Append("ORDER BY tblHRData.Lname")




    This is the error im getting

    Syntax error (missing operator) in query expression … Syntax error (missing operator) in query expression 'tblJobTitle.JobTitleFROM (tblHRData INNER JOIN tblJobTitle ON tblHRData.JobID = tblJobTitle.JobID)ORDER BY tblHRData.Lname'.

    Don't know mysql very well but if you are bulding it dyamically do you not require a space in between the column and the FROM ie.
    'tblJobTitle.JobTitle FROM not 'tblJobTitle.JobTitleFROM

    Doubt it will work but maybe worth a go

    Original Poster

    thedish;4109814

    Don't know mysql very well but if you are bulding it dyamically do you … Don't know mysql very well but if you are bulding it dyamically do you not require a space in between the column and the FROM ie. 'tblJobTitle.JobTitle FROM not 'tblJobTitle.JobTitleFROMDoubt it will work but maybe worth a go



    hi thanks it worked. I have gave you rep points, Thank you Thedish.:thumbsup:

    Original Poster

    another one...

    MyStringBuilder.Append("SELECT ArtistID, Artist, Category FROM … MyStringBuilder.Append("SELECT ArtistID, Artist, Category FROM tblArtists") MyStringBuilder.Append("ORDER BY ArtistID")



    I got this error

    Syntax error in FROM clause.

    Again, put a space character at the end of the first string "SELECT ArtistID, Artist, Category FROM tblArtists " or at the beginning of the second " ORDER BY ArtistID".

    BFN,

    fp.

    Original Poster

    fanpages;4116217

    Again, put a space character at the end of the first string "SELECT … Again, put a space character at the end of the first string "SELECT ArtistID, Artist, Category FROM tblArtists " or at the beginning of the second " ORDER BY ArtistID".BFN,fp.



    I got it done in the end, I didn't need to use the append builder, but thanks for the help fanpages, Have repped you for effort and help.

    black gerbil1;4116230

    I got it done in the end, I didn't need to use the append builder, but … I got it done in the end, I didn't need to use the append builder, but thanks for the help fanpages, Have repped you for effort and help.



    You're very welcome.

    Happy coding...

    BFN,

    fp.
    Post a comment
    Avatar
    @
      Text
      Top Discussions
      1. 10% Argos code with glitch22
      2. Safest type of external hard drive?33
      3. Jury service47
      4. Three connection56

      See more discussions