SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Location
    location location
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL question about INSERT INTO .... SELECT

    Because MySQL doesn't allow views or subselects I'm trying to get around it by creating an intermediate table and fill it with the records from the first select. The select looks something like this

    insert into intermediate (unique_id, registration_id)
    select 111, ez.registration_id
    from table

    If I just do the select it retreives 2 rows but if I run it like this, it only creates one row. Does anyone know what this problem is, I've been looking around the net for a couple of hours and I can't find anything, so any help would be greatly appreciated.

    Mike

  2. #2
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    some column(s) in intermediate is(are) probably unique. what does it say if you run that from the mysql command line?
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Location
    location location
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Matt,

    Thanks for the reply. It was a unique problem but I was using MySQL front to do testing and it didn't give an error message, which was the bit which throw me off the track. I'm used to Oracle and that would have given me an error message.

    Thanks.


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
  •