I created a test view. It displays data of a content type 'Anagrafiche (name for internal use: contatti)'. The view has the following fields (sorry for the interface language):
- Contenuto: Immagine (Img) it's an image field
- Contenuto: Nome (Name) it's a text field
- Contenuto: Cognome (Surname) it's a text field
I used the proposed code for the following question, to get a 'clean' query: link
But the output was not what was expected:
SELECT
node.nid AS nid,
node.created AS node_created,
node.changed AS node_changed,
users_node.name AS users_node_name,
users_node.uid AS users_node_uid,
'node' AS field_data_field_immagine_node_entity_type,
'node' AS field_data_field_nome_node_entity_type,
'node' AS field_data_field_cognome_node_entity_type
FROM node AS node
LEFT JOIN users AS users_node
ON node.uid = users_node.uid
LEFT JOIN field_data_field_cognome AS field_data_field_cognome
ON node.nid = field_data_field_cognome.entity_id
AND (field_data_field_cognome.entity_type = 'node'
AND field_data_field_cognome.deleted = 0)
WHERE (( (node.status = 1)
AND (node.type IN ('contatti')) ))
ORDER BY
field_data_field_cognome.field_cognome_value ASC
LIMIT 20 OFFSET 0
I do not have very clear how the correct output should be, but by looking at the query, I gather that this piece is not correct
'node' AS field_data_field_immagine_node_entity_type,
'node' AS field_data_field_nome_node_entity_type,
'node' AS field_data_field_cognome_node_entity_type
I also tried alternatives like the 'Devel' module and different types of hooks, but I never got what I wanted
@mikeytown2 I ran the query inside phpmyadmin this is the result:
but the last three columns should not be node | node | node
,
but something like thatimg | myName | mySurname