Welcome Guest, Not a member yet? Register   Sign In
Oracle join tables
#1

[eluser]atomp3[/eluser]
Hi

I'm trying to execute query on CI and Oracle

Code:
$this->db->select('*');
    $this->db->from('CCGW_LOG');
    $this->db->join('CCGW_MSG_XMLDATA', 'LOG_ID = LOG_ID');
    $this->db->limit(10);
    
    $query = $this->db->get();
    
    return $query->result_array();

but getting error: Call to a member function result_array()

on error TRUE:

SELECT * FROM (select inner_query.*, rownum rnum FROM (SELECT * FROM "CCGW_LOG" JOIN "CCGW_MSG_XMLDATA" ON "LOG_ID" = "LOG_ID" ) inner_query WHERE rownum < 10)



When comment:

Code:
$this->db->join('CCGW_MSG_XMLDATA', 'LOG_ID = LOG_ID');

query executing fine.

How to use join tables with Oracle?

Thanks for help
#2

[eluser]Relexx[/eluser]
[quote author="atomp3" date="1235415931"]SELECT * FROM (select inner_query.*, rownum rnum FROM (SELECT * FROM "CCGW_LOG" JOIN "CCGW_MSG_XMLDATA" ON "LOG_ID" = "LOG_ID" ) inner_query WHERE rownum < 10)
[/quote]

Traditionally Oracle table joins are in there where clause.

Code:
select rownum, *
from (select ccgw_log.*, ccgw_msg_xmldata.*
      from ccgw_log, ccgw_msg_xmldata
      where ccgw_log.log_id = ccgw_msg_xmldata.log_id)
where rownum < 10

having said all that this like could be your problem
[quote author="atomp3" date="1235415931"]
Code:
$this->db->join('CCGW_MSG_XMLDATA', 'LOG_ID = LOG_ID');
[/quote]
which log_id is connecting to which log_id, try prefixing log_id with the table_name.




Theme © iAndrew 2016 - Forum software by © MyBB