SELECT node.nid AS nid, (
SELECT node_data_field_image.field_image_fid AS node_data_field_image_field_image_fid
FROM content_type_image node_data_field_image
WHERE node_data_field_image.vid = node.vid
) AS node_data_field_image_field_image_fid,
node.type AS node_type,
node.vid AS node_vid,
node.created AS node_created
FROM node node
WHERE (node.status <>0)
AND (node.type IN ('image', 'video'))
ORDER BY node_created DESC
LIMIT 0 , 30
How can I return more than 1 column from inner select??
I need this query to be in this form, dont ask me why Im making this.
Because I have to rewrite existing query, i dont control all the process.
If I use join for this query the performance will be lower, since join will be executed before select.
I can use sub select to acheive this, but I can’t do this since I can’t control LIMIT statement, and the limit statmement for the outer select is something like 175, 15. And if use subselect it should be simply LIMIT 15 but thats not possible for me.
I need this query to be in this form, dont ask me why Im making this.
do you mean by this, that you need the resultset from the query to be such that it matches/integrates with post-processing code? if so - and I know I am breaching your request not to ask… - how can you expect a response here to give you the best query?
Much better to get the correct resultset and then, to post-process’.
I’m not getting at you it’s difficult sometimes to ask the ‘best’ question when you are trying to fit in with existing stuff.