947740 Posted June 17, 2009 Share Posted June 17, 2009 I need to select all of the data from these two tables with one query: +----------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+---------------------+------+-----+---------+----------------+ | ID | bigint(20) unsigned | NO | PRI | NULL | auto_increment | | sname | varchar(50) | YES | | NULL | | | snumber | int(4) | YES | | NULL | | | date | varchar(30) | YES | | NULL | | | numberof | int(2) | YES | | NULL | | | teacher | varchar(50) | YES | | NULL | | | com_rea | varchar(255) | YES | | NULL | | +----------+---------------------+------+-----+---------+----------------+ +----------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+---------------------+------+-----+---------+----------------+ | ID | bigint(20) unsigned | NO | PRI | NULL | auto_increment | | sname | varchar(50) | YES | | NULL | | | snumber | int(4) | YES | | NULL | | | date | varchar(30) | YES | | NULL | | | numberof | int(2) | YES | | NULL | | | teacher | varchar(50) | YES | | NULL | | | com_rea | varchar(255) | YES | | NULL | | +----------+---------------------+------+-----+---------+----------------+ I will also have where clauses for both tables. Any examples would be helpful. Link to comment https://forums.phpfreaks.com/topic/162613-solved-two-tablesjoin/ Share on other sites More sharing options...
fenway Posted June 22, 2009 Share Posted June 22, 2009 Sounds like you need a UNION. BTW, BIGINT is likely waaay too big... just slows down index usage. INT UNSIGNED is more than sufficient, since I doubt you'll have >4 billion records in a single table. Link to comment https://forums.phpfreaks.com/topic/162613-solved-two-tablesjoin/#findComment-860970 Share on other sites More sharing options...
947740 Posted June 22, 2009 Author Share Posted June 22, 2009 Thanks fenway. Link to comment https://forums.phpfreaks.com/topic/162613-solved-two-tablesjoin/#findComment-861263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.