1

I'm developing a Joomla 3 component and I'm trying to select data from database using the Joomla framework classes. I'm getting a error Not unique table/alias. What could be the reason ?.

Code Snippet...

$app = JFactory::getApplication();
        $job_id = JRequest::getVar('Jobid', null);
        try {
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);//Here Was The Problem
            $query->select(array('A.state AS approval_state', 'A.*', 'B.*', 'C.district_name', 'D.educational_qualification', 'E.current_job_status'))
                    ->from($db->quoteName('#__pes_job_provider_request_cv_info') . 'AS A')
                    ->join('LEFT', '#__pes_jobseeker_profile AS B ON B.jobseeker_profile_id = A.jobseeker_profile_id')
                    ->join('LEFT', '#__pes_district AS C ON C.district_id = A.district_id')
                    ->join('LEFT', '#__pes_highest_educational_qualification AS D ON D.highest_educational_qualification_id = B.highest_educational_qualification_id')
                    ->join('LEFT', '#__pes_current_job_status AS E ON E.current_job_status_id = B.current_job_status_id')
                    ->where($db->quoteName('A.job_order_registration_id') . ' = ' . $db->quote($job_id))
                    ->order('B.name_in_full ASC');
            $db->setQuery($query);
            $results = $db->loadObjectList();

Thank You.

1 Answers1

3

OK ! I figured out the reason.

The reason why this happened is that I haven't instantiated the query object as a new query.

i.e. $query = $db->getQuery();

So, in order to resolve the issue I simply gave the parameter boolean true for the query method

i.e. $query = $db->getQuery(true);