Welcome Guest, Not a member yet? Register   Sign In
Want a Codeigniter Query

I have an issue in connecting the data in my current project, Please look in the details in file attached.

PHP Code:
insert into t_category (categoryparent_category)
select t1.t_categoryt3.parent_id 
from t_csv t1
left join t_category t2 on t1
.category t2.category
left join t_pcategory t3 on t1
.parent_category t3.parent_category
where t2
.id is null and t3.parent_category is not null) as t5 
try this query, is shoul work.  

And read about  "correlated and non correlated query" , http://www.programmerinterview.com/index...-subquery/

your query is uncorrelated, thus its much slower than correlated ones, query above is correlated. when u have 100k > rows, using uncorrelated query may take hours to finish, where correlated ones may take 1-5mins

I got this error:
A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as t5' at line 6

insert into t_category (category, parent_category)
(select CSV.t_category, PCAT.parent_id from t_csv CSV
left join t_category CAT on CSV.category = CAT.category
left join t_pcategory PCAT on CSV.parent_category = PCAT.parent_category
where CAT.id is null and PCAT.parent_category is not null) as t5

Filename: models/Super_admin_model.php

Line Number: 1030


Have you resolved this issue?

Theme © iAndrew 2016 - Forum software by © MyBB