Part of the EllisLab Network
   
 
ActiveRecord messing up FROM
Posted: 24 October 2008 11:20 AM   [ Ignore ]  
Summer Student
Total Posts:  15
Joined  04-27-2008

Here is my ActiveRecord:

function getScriptures() {
        $this
->db->select('book_id AS vbook, chapter, verse, text, books.name AS book');
        
$this->db->where('books.name'$this->uri->segment(3));
        
$this->db->from('scriptures');
        
$this->db->join('books''book_id = books.id''inner');
        
$this->db->order_by('chapter''asc');
        
$this->db->order_by('verse''asc');
        
$query $this->db->get('scriptures');
        return 
$query->result_array();
    

Here is the SQL it returns:

SELECT `book_id` AS vbook, `chapter`, `verse`, `text`, `books`.`name` AS book
FROM 
(`scriptures`, `scriptures`)
INNER JOIN `booksON `book_id` = `books`.`id`
WHERE `books`.`name` = 'jude'
ORDER BY `chapterasc, `verseasc 

That of course returns with this error:

Error Number1066
Not unique table
/alias'scriptures' 

If I take out that second ‘scriptures’ from the FROM field the SQL runs correct in the MySQL Query Browser. I’m posting this in the bug reports because it worked fine until updating.

Profile
 
 
Posted: 29 October 2008 06:19 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  4
Joined  10-06-2008

exactly: http://codeigniter.com/forums/viewthread/95148/


Cheers mate!

Profile