Skip to main content
deleted 26 characters in body
Source Link

JustIf you don't have to pull in a whole bunch of linked entity stuff, just run a regular db_query() joining your "importance" field table to your node table.

$query = "SELECT nid, (created * field_importance_value) AS weight FROM node n JOIN field_data_field_importance f ON f.entity_id = n.nid WHERE entity_type = 'node' AND type = 'news' AND status = 1 ORDER BY weight DESC"; $result = db_query($query); // Add foreach loop here...

I'm just guessing the importance table name and field name from your OP.

Just run a regular db_query() joining your "importance" field table to your node table.

$query = "SELECT nid, (created * field_importance_value) AS weight FROM node n JOIN field_data_field_importance f ON f.entity_id = n.nid WHERE entity_type = 'node' AND type = 'news' AND status = 1 ORDER BY weight DESC"; $result = db_query($query); // Add foreach loop here...

I'm just guessing the importance table name and field name from your OP.

If you don't have to pull in a whole bunch of linked entity stuff, just run a regular db_query() joining your "importance" field table to your node table.

$query = "SELECT nid, (created * field_importance_value) AS weight FROM node n JOIN field_data_field_importance f ON f.entity_id = n.nid WHERE type = 'news' AND status = 1 ORDER BY weight DESC"; $result = db_query($query); // Add foreach loop here...

I'm just guessing the importance table name and field name from your OP.

Source Link

Just run a regular db_query() joining your "importance" field table to your node table.

$query = "SELECT nid, (created * field_importance_value) AS weight FROM node n JOIN field_data_field_importance f ON f.entity_id = n.nid WHERE entity_type = 'node' AND type = 'news' AND status = 1 ORDER BY weight DESC"; $result = db_query($query); // Add foreach loop here...

I'm just guessing the importance table name and field name from your OP.