Buy Now
Sign in

CCV6 Model Join bug

elgenoveis , February 23 2017
E
elgenoveis
I've a problem on joining 2 tables, it doesn't recognise the "atleta" primary key to join to "socio.user", or still, i don't know how to set it.

I used quite all the "relation" combination to make it, but it still leaves the atleta column empty.

Here's the error:

1054 Unknown column 'atleta.' in 'on clause' SQL=SELECT COUNT(*) AS `socio.count` FROM `myaiq_librosoci` AS `socio` LEFT JOIN `myaiq_atleti` AS `atleta` ON `socio`.`user` = `atleta`.``;



it should be " ON `socio`.`user` = `atleta`.`id`; "
admin
Hi,

What is the primary model here ? both tables have primary keys ? please post a screenshot of the secondary model settings section.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
E
elgenoveis
I tried to name both the primary key as user_id [yeah they're both primary and unique keys]

still: 1054 Unknown column 'atleta.' in 'on clause' SQL=SELECT COUNT(*) AS `socio.count` FROM `#__librosoci` AS `socio` LEFT JOIN `#__atleti` AS `atleta` ON `socio`.`user_id` = `atleta`.``;
Attachments
Cattura.PNG
Cattura.PNG
(10.55 KiB)
156 Downloads/Views
Cattura2.PNG
Cattura2.PNG
(19.59 KiB)
152 Downloads/Views
E
elgenoveis
I tried to use the custom Project "articles relaction":

1054 Unknown column 'Author.' in 'on clause' SQL=SELECT COUNT(`Article`.`id`) AS `Article.count` FROM `#__content` AS `Article` LEFT JOIN `#__users` AS `Author` ON `Article`.`created_by` = `Author`.``;

Same problem
admin
It looks like there is a problem getting the primary key of the table, what is your mysql version ? could you please try to click the "delete cache" button in the admin area ?

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
E
elgenoveis
MySQL 5.6.33-cll-lve - MySQL Community Server (GPL)

Tried. Nothing at all.
I also used a brand new database without views (trying to understand if primary keys depends on it), nothing.
admin
Hi elgenoveis,

What is the result when you run the following query in your phpmyadmin:

DESCRIBE #__content;


?

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
E
elgenoveis
DESCRIBE #__content;

DESCRIBE
Messaggio di MySQL: Documentazione

#1064 - Errore di sintassi nella query SQL vicino a '' linea 1 [syntax error]


DESCRIBE iscrizioni_content;

La query SQL è stata eseguita con successo.

DESCRIBE iscrizioni_content ( dunnowhy, #__ makes problem)

id  int(10) unsigned  NO  PRI    auto_increment  
asset_id  int(10) unsigned  NO    0    
title  varchar(255)  NO        
alias  varchar(400)  NO        
introtext  mediumtext  NO        
fulltext  mediumtext  NO        
state  tinyint(3)  NO  MUL  0    
catid  int(10) unsigned  NO  MUL  0    
created  datetime  NO    0000-00-00 00:00:00    
created_by  int(10) unsigned  NO  MUL  0    
created_by_alias  varchar(255)  NO        
modified  datetime  NO    0000-00-00 00:00:00    
modified_by  int(10) unsigned  NO    0    
checked_out  int(10) unsigned  NO  MUL  0    
checked_out_time  datetime  NO    0000-00-00 00:00:00    
publish_up  datetime  NO    0000-00-00 00:00:00    
publish_down  datetime  NO    0000-00-00 00:00:00    
images  text  NO        
urls  text  NO        
attribs  varchar(5120)  NO        
version  int(10) unsigned  NO    1    
ordering  int(11)  NO    0    
metakey  text  NO        
metadesc  text  NO        
access  int(10) unsigned  NO  MUL  0    
hits  int(10) unsigned  NO    0    
metadata  text  NO        
featured  tinyint(3) unsigned  NO  MUL  0    
language  char(7)  NO  MUL      
xreference  varchar(50)  NO  MUL      
admin
Hi elgenoveis,

Ok, I'm not sure why this problem occurs but you can use the "relation conditions" instead of the foreign key:
Article.created_by:Author.id


Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!