I have a simple query right now, a db_select that returns the fields I need, but the problem is that one field is entity reference and I don't know how to get its fields from the db_select.

The other thing is that entity reference I'm talking about has another entity reference in it, and I would like to get its fields too.

  • Just use a JOIN. If it's an entity reference field the column in the field table will be called field_FIELD_NAME_target_id. If you want more specific advice, it'd be best to include the code and more explanation of exactly what doesn't work – Clive Jan 15 '15 at 10:04
  • @Clive, thank you, I'll try the normal join with the name of the field you provided. – teeyo Jan 15 '15 at 10:07
  • @Clive, I changed the entity reference to node reference but still I can't select fields of that content type in the node reference from my db_select – teeyo Jan 15 '15 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.