• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Join on Table Named with Dash Produces 1054 Error

#1
[eluser]oppenheimer[/eluser]
Active record join doesn't work when a table name includes a dash "-". For example:

Code:
$this->db->select('*');
$this->db->from('12-registration');
$this->db->join('12-students', '12-students.studentid = 12-registration.studentid');
$query = $this->db->get();
return ($query->row_array());

Produces the following error:


Code:
A Database Error Occurred

Error Number: 1054

Unknown column '12' in 'on clause'

SELECT * FROM (`12-registration`) JOIN `12-students` ON `12`-`students`.`studentid` = 12-registration.studentid

Notices the ON clause is unusually quoted. The active record class works well on those tables in all other respects.

Any ideas?


Messages In This Thread
Join on Table Named with Dash Produces 1054 Error - by El Forum - 04-04-2010, 09:03 AM
Join on Table Named with Dash Produces 1054 Error - by El Forum - 04-04-2010, 05:22 PM
Join on Table Named with Dash Produces 1054 Error - by El Forum - 09-22-2014, 10:26 AM
Join on Table Named with Dash Produces 1054 Error - by El Forum - 09-22-2014, 10:36 AM
Join on Table Named with Dash Produces 1054 Error - by El Forum - 09-24-2014, 02:15 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.