SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Passionate Web Developer Egyptechno's Avatar
    Join Date
    Jan 2004
    Location
    Dubai
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question what's the wrong with this [ UNION STATMENT ]

    Iam trying to run an Union MySQL Statment ..

    but It keeps showing this error :
    PHP Code:
    The used SELECT statements have a different number of columns 

    this is the query :
    PHP Code:
    mysql_query("select * from users UNION select * from config") or die(mysql_error()); 
    and I've tried this too :
    PHP Code:
    mysql_query("select * from users, UNION select * from config") or die(mysql_error()); 
    I've tried also to google about Union Syntax with MySQL but didn't find anything ..

    any ideas ?

    Thanks

  2. #2
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Staffordshire, UK & Florida, USA
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The used SELECT statements have a different number of columns
    From the MySQL Manual: "Selected columns listed in corresponding positions of each SELECT statement should have the same data type. (For example, the first column selected by the first statement should have the same type as the first column selected by the other statements.)"

    http://dev.mysql.com/doc/refman/4.1/en/union.html


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
  •