Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    87

    Unanswered: problem with this query

    Hi everybody am trying to create a table from a select query but i always get the wrong syntax error.. couldn't find where it is here is the query

    SELECT *
    INTO TEMP_PUBS
    FROM
    (SELECT p.id, p.pub, i.name
    FROM dbo.info i INNER JOIN dbo.temp_pubs p ON i.infid = p.pubinfid
    WHERE (p.pubpub = 'e') AND (p.publang = 'e'))

    thanks for any help

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If you're using a subquery you need to give it an alias
    Code:
    SELECT * 
    INTO   TEMP_PUBS
    FROM   (
            SELECT p.id
                  , p.pub
                  , i.name
            FROM    dbo.info i
             INNER
              JOIN dbo.temp_pubs p
                ON i.infid = p.pubinfid
            WHERE  (p.pubpub = 'e')
            AND    (p.publang = 'e')
            ) As an_alias
    Alternatively, the example provided doesn't require a subquery
    Code:
    SELECT p.id
          , p.pub
          , i.name
    INTO    TEMP_PUBS
    FROM    dbo.info i
     INNER
      JOIN dbo.temp_pubs p
        ON i.infid = p.pubinfid
    WHERE  (p.pubpub = 'e')
    AND    (p.publang = 'e')
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2006
    Posts
    87
    Thanks George That Made It!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •