jetpacmidge Posted November 17, 2006 Share Posted November 17, 2006 Hi,I am using PHP v5, MYSQL v5 and Apache v1.3.When I try and enter a query into the MYSQL command client line I am unable to enter data into the table :-SQL query :-[code]INSERT INTO fixturesresults (season,age,division,hometeam,awayteam) VALUES (SELECT home.season,home.age,home.division,home.team,away.team FROM team as home, team as away WHERE home.team !=away.team);[/code]TABLE NAME - team+----------+----------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+----------+----------+------+-----+---------+-------+| season | char(10) | NO | PRI | NULL | || age | char(15) | NO | PRI | NULL | || division | char(20) | NO | PRI | NULL | || team | char(30) | NO | PRI | NULL | |+----------+----------+------+-----+---------+-------+TABLE NAME - fixturesresults+-----------+-----------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+-----------+-----------------+------+-----+------------+-------+| season | char(10) | NO | PRI | NULL | || age | char(15) | NO | PRI | NULL | || division | char(20) | NO | PRI | NULL | || hometeam | char(30) | NO | PRI | NULL | || awayteam | char(30) | NO | PRI | NULL | || homescore | int(3) unsigned | NO | | 0 | || awayscore | int(3) unsigned | NO | | 0 | || date | date | NO | | 0000-00-00 | |+-----------+-----------------+------+-----+------------+-------+ERROR MESSAGE :-[code]ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'SELECT home.season,home.age,home.division,home.team,away.team FROM team as home,' atline 1[/code]Thanks :shock: Link to comment https://forums.phpfreaks.com/topic/27583-mysql-error-message-unable-to-enter-data-in-table/ Share on other sites More sharing options...
exploo Posted November 17, 2006 Share Posted November 17, 2006 I don't think there should be a VALUES when your using insert ... select[code]INSERT INTO fixturesresults (season,age,division,hometeam,awayteam) SELECT home.season, home.age, home.division, home.team, away.team FROM team as home, team as away WHERE home.team !=away.team;[/code]/Magnus Link to comment https://forums.phpfreaks.com/topic/27583-mysql-error-message-unable-to-enter-data-in-table/#findComment-126237 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.