Can I select * (all columns) except exclude a couple of them?

Discussion in 'MySQL' started by 123GoToAndPlay, May 17, 2009.

  1. #1
    Is this possible as i want to copy a mysql table except for the id column and insert all values into tablecopy??
     
    123GoToAndPlay, May 17, 2009 IP
  2. alfa_375

    alfa_375 Active Member

    Messages:
    445
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    yes, you cand by this

    Instead of using "*" in the select statement, use column names which require to copy leave the id column if you dont want.

    Select column1, column2, column3 from tablename;
     
    alfa_375, May 17, 2009 IP
  3. bl4ckwolf

    bl4ckwolf Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Alfa is right, the only way of doing this is to select manually all the column you want.

    You can also create a view of the table with the field you want and then do a "select *" from that view.

    Cheers.
     
    bl4ckwolf, May 23, 2009 IP