Results 1 to 5 of 5

Thread: Problem of nested query

  1. #1
    Join Date
    Nov 2009
    Posts
    45

    Problem of nested query

    I have an error in my following query, it does not like the 2nd part. I have yet tested the "SELECT id FROM ..." all alone and it returns the ID property to erase:
    Code:
    DELETE FROM `crm_comment` WHERE id_comment in
    (SELECT id FROM `crm_temps` WHERE crm_temps.salary='yann' and crm_temps.journey='2009-12-04' and crm_temps.id_project='58' )
    MySQL gives the error message:

    #1064 - 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 'SELECT id
    FROM `crm_temps`
    WHERE crm_temps.salary = 'yann'
    What could be the problem of my above query?

  2. #2
    Join Date
    Nov 2008
    Posts
    1,022

    Re: Problem of nested query

    Why did you drop your table name in the from clause and not in the where clause? I see mysql is getting stuck over there.

  3. #3
    Join Date
    Nov 2009
    Posts
    45

    Re: Problem of nested query

    Thank you for your comment, I tried this:

    Code:
    DELETE FROM `crm_comment` WHERE `id_comment` IN (
    SELECT `id`
    FROM `crm_temps`
    WHERE `crm_temps.salary` = `yann` AND `crm_temps.journey` = `2009 - 12 - 04` AND `crm_temps.id_project` = `58`
    )
    I got this error message:

    #1064 - 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 'SELECT `id`
    FROM `crm_temps`
    WHERE `crm_temps.salary` =

  4. #4
    Join Date
    Nov 2008
    Posts
    996

    Re: Problem of nested query

    it is rather
    Code:
        DELETE FROM `crm_comment` WHERE id_comment IN (
        SELECT id
        FROM `crm_temps` WHERE `crm_temps`.salary = 'yann' AND `crm_temps`.journey = '2009 - 12 - 04' AND `crm_temps`.id_project = 58
        )

  5. #5
    Join Date
    Nov 2009
    Posts
    45

    Re: Problem of nested query

    With a copy/paste of your query, I got this:

    #1064 - 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 'SELECT id
    FROM `crm_temps`
    WHERE `crm_temps`.salary = 'yan
    But in between the 2 queries, they work well ...

    Is it that it would be not recognized? I tried with 'match' but still an error.

Similar Threads

  1. Problem with nested div when the content width exceeds window size
    By Laurense in forum Software Development
    Replies: 5
    Last Post: 04-03-2010, 07:58 PM
  2. Problem in Nested folder in .NET
    By rashmi_ay in forum Software Development
    Replies: 3
    Last Post: 30-11-2009, 10:36 PM
  3. need LDAP query to capture nested group ?
    By vivekmohan in forum Active Directory
    Replies: 4
    Last Post: 25-06-2009, 12:10 AM
  4. Problem with width for nested div padding
    By Jaisudha in forum Software Development
    Replies: 3
    Last Post: 22-06-2009, 12:28 PM
  5. Problem of SQL query
    By Sonic in forum Software Development
    Replies: 5
    Last Post: 18-12-2008, 12:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,532,387.13432 seconds with 17 queries