• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Want a Codeigniter Query

#1
[attachment=825][attachment=826]
I have an issue in connecting the data in my current project, Please look in the details in file attached.
Reply

#2
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
Reply

#3
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
Reply

#4
@apysan,

Have you resolved this issue?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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