drupal how run a view directly into the mysql database

in the preview area of ​​a view, we are informed that the mysql query that is run so as we get the results in the gui, is the following. It has a strange syntax, which i do not know how i should translate it so as to run it directly in mysql, as a query that works and brings me correct results.

How would you suggest the below query should be altered so as to get the desired results? One problem i face, is that in many columns, instead of values, i just get the value node. But in there, it should be a value that is referenced and should be retrieved by another table in mysql. Any help would be higly appreciated, since the below query does not return results via the gui, since it takes a lot of time, and we get time out.

Query   
SELECT node_field_data_field_title.title AS node_field_data_field_title_title, node.nid AS nid, node.created AS node_created, node_field_data_field_title.nid AS node_field_data_field_title_nid, field_data_field_it_accession_nr.field_it_accession_nr_value AS field_data_field_it_accession_nr_field_it_accession_nr_value, field_data_field_collection.field_collection_nid AS field_data_field_collection_field_collection_nid, field_data_field_teuxos_year.field_teuxos_year_value AS field_data_field_teuxos_year_field_teuxos_year_value, field_data_field_it_volume.field_it_volume_value AS field_data_field_it_volume_field_it_volume_value, field_data_field_it_callnumber.field_it_callnumber_value AS field_data_field_it_callnumber_field_it_callnumber_value, 'node' AS field_data_field_item_type_node_entity_type, 'node' AS field_data_field_it_accession_nr_node_entity_type, 'node' AS field_data_field_collection_node_entity_type, 'node' AS field_data_field_taksithetiko_node_entity_type, 'node' AS field_data_field_avail_status_node_entity_type, 'node' AS field_data_field_location_node_entity_type, 'node' AS field_data_field_it_volume_node_entity_type, 'node' AS field_data_field_it_volume_title_node_entity_type, 'node' AS field_data_field_it_volume_year_node_entity_type, 'node' AS field_data_field_pt_leg_created_date_node_entity_type, 'node' AS field_data_field_it_condition_node_entity_type, 'node' AS field_data_field_it_condition_other_node_entity_type, 'node' AS field_data_field_it_charge_days_node_entity_type, 'node' AS field_data_field_item_files_node_entity_type, 'node' AS field_data_field_item_rights_node_entity_type, 'node' AS field_data_field_files_channel_node_entity_type, 'node' AS field_data_body_node_entity_type, 'node' AS field_data_field_item_private_notes_node_entity_type, 'node' AS field_data_field_item_bibliodesia_node_entity_type, 'node' AS field_data_field_item_prosktisi_node_entity_type, 'node' AS field_data_field_item_supplier_node_entity_type, 'node' AS field_data_field_it_leg_price_node_entity_type, 'node' AS field_data_field_it_invoice_node_entity_type, 'node' AS field_data_field_it_invoice_date_node_entity_type, 'node' AS field_data_field_teuxos_xronologia_node_entity_type, 'node' AS field_data_field_teuxos_tomos_node_entity_type, 'node' AS field_data_field_teuxos_teuxos_node_entity_type, 'node' AS field_data_field_teuxos_pollaplotita_node_entity_type, 'node' AS field_data_field_teuxos_ektakto_node_entity_type, 'node' AS field_data_field_item_link_node_entity_type, 'node' AS field_data_field_antityponame_node_entity_type, 'node' AS field_data_field_teuxos_year_node_entity_type, 'node' AS field_data_field_teuxos_day_node_entity_type, 'node' AS field_data_field_teuxos_month_node_entity_type, 'node' AS field_data_field_hidden_node_entity_type, 'node' AS field_data_field_demeno_node_entity_type, 'node' AS field_data_field_barcode_node_entity_type, 'node' AS field_data_field_files_hidden_node_entity_type, 'node' AS field_data_field_default_title_file_node_entity_type, 'node' AS field_data_field_reader_dig_file_node_entity_type, 'node' AS field_data_field_image_node_entity_type, 'node' AS field_data_field_dewey_node_entity_type, 'node' AS field_data_field_tl_uuid_node_entity_type
FROM 
{node} node
LEFT JOIN {field_data_field_title} field_data_field_title ON node.nid = field_data_field_title.entity_id AND field_data_field_title.entity_type="node"
LEFT JOIN {node} node_field_data_field_title ON field_data_field_title.field_title_nid = node_field_data_field_title.nid
LEFT JOIN {og_membership} og_membership_node ON node.nid = og_membership_node.etid AND og_membership_node.entity_type="node"
LEFT JOIN {field_data_field_deleted} field_data_field_deleted ON node.nid = field_data_field_deleted.entity_id AND field_data_field_deleted.field_deleted_value="1"
LEFT JOIN {field_data_field_it_accession_nr} field_data_field_it_accession_nr ON node.nid = field_data_field_it_accession_nr.entity_id AND field_data_field_it_accession_nr.entity_type="node"
LEFT JOIN {field_data_field_collection} field_data_field_collection ON node.nid = field_data_field_collection.entity_id AND field_data_field_collection.entity_type="node"
LEFT JOIN {field_data_field_teuxos_year} field_data_field_teuxos_year ON node.nid = field_data_field_teuxos_year.entity_id AND field_data_field_teuxos_year.entity_type="node"
LEFT JOIN {field_data_field_it_volume} field_data_field_it_volume ON node.nid = field_data_field_it_volume.entity_id AND field_data_field_it_volume.entity_type="node"
LEFT JOIN {field_data_field_it_callnumber} field_data_field_it_callnumber ON node.nid = field_data_field_it_callnumber.entity_id AND field_data_field_it_callnumber.entity_type="node"
WHERE (( (og_membership_node.gid = '672621' ) )AND(( (node.status="1") AND (node.type IN  ('item')) AND (field_data_field_deleted.field_deleted_value IS NULL ) )))
ORDER BY field_data_field_it_accession_nr_field_it_accession_nr_value ASC, field_data_field_collection_field_collection_nid ASC, field_data_field_teuxos_year_field_teuxos_year_value ASC, field_data_field_it_volume_field_it_volume_value ASC, field_data_field_it_callnumber_field_it_callnumber_value ASC

Leave a Comment