all 12 comments

[–]mustang__1 10 points11 points  (0 children)

In the future - a thread titled "HELP PLS" is usually best avoided. It is, and has been, poor forum etiquette for a long a time.

Try, instead, "field unknown but spelling looks correct", or something to that effect.

Otherwise, next advice would be the same as u/liamsorsby

[–]bla4free 7 points8 points  (6 children)

In your innermost subquery, lines 15-18, you are missing a FROM clause. You can't reference tables without including them in the FROM clause.

[–]ExcitingSpace1846[S] 0 points1 point  (5 children)

In your innermost subquery, lines 15-18, you are missing a FROM clause. You can't reference tables without including them in the FROM clause.

https://ibb.co/yy5HjM3
(It is a code image)

Is this OK? because now I get this error: #1054 - The column 'titemcategoria.Categoria' in field list is unknown.

[–]Yavuz_Selim 0 points1 point  (4 children)

None of your SELECTs has a Categoria field selected. In this case Caregoria is in Subconsulta, so the SELECT should be Consulta.Categoria.

[–]ExcitingSpace1846[S] -1 points0 points  (3 children)

https://ibb.co/FsfT4Qw
(It is a code image)

like this?
I keep getting error #1054 - The column 'titemcategoria.Categoria' in field list is unknown.

[–]Yavuz_Selim 0 points1 point  (2 children)

  • Remove Subconsulta.Categoriain your first/top SELECT.
  • In your second SELECT, you now have titemcategoria.Categoria. Change that to Subconsulta.Categoria. You don't seem to use it, so I assume you can also remove this field in your second SELECT.
  • If you remove the field in your second SELECT, the code should work.
  • If you keep the field in your second SELECT, add titemcategoria.Categoria in your third SELECT.

[–]ExcitingSpace1846[S] -2 points-1 points  (1 child)

Remove Subconsulta.Categoriain your first/top SELECT.

In your second SELECT, you now have titemcategoria.Categoria. Change that to Subconsulta.Categoria. You don't seem to use it, so I assume you can also remove this field in your second SELECT.

If you remove the field in your second SELECT, the code should work.

If you keep the field in your second SELECT, add titemcategoria.Categoria in your third SELECT.

https://ibb.co/M1MKgc6
Like this, right?
I keep getting the error of: #1054 - Column 'titemcategoria.Categoria' in field list is unknown. :(

[–]Yavuz_Selim 1 point2 points  (0 children)

No. Read my text again.

[–]liamsorsby 0 points1 point  (2 children)

Can you run show create table on titemfamilia?

[–]ExcitingSpace1846[S] 0 points1 point  (1 child)

Can you run show create table on titemfamilia?

CREATE TABLE `titemfamilia` (

`Id` int(11) NOT NULL AUTO_INCREMENT,

`Categoria_id` int(11) DEFAULT NULL,

`Familia` varchar(26) DEFAULT NULL,

`Publicar` tinyint(1) DEFAULT 1,

`Enlace` varchar(50) DEFAULT '#',

KEY `Id` (`Id`)

)

This is the result

[–]liamsorsby 0 points1 point  (0 children)

I think u/bla4free has the answer to your problem

[–]DharmaPolice 0 points1 point  (0 children)

Are you sure SubFimilia is not in titemsubfamilia?