Hi,

Manuel Vacelet wrote:
Hi all,

I have a list of values I get from my application and I want to
generate a record set based on this list (for an INSERT INTO ...
SELECT).

Today I have sth like:

SELECT 54, item.item_id, mdv.valueInt
FROM item i, metadata_value mdv
WHERE mdv.item_id = 20202
AND mdv.field_id = 54
AND i.item_id IN (20203,20204,20205,20206,20223,20207,20208);

Is it possible not to make a look-up in 'item' table ?

I'm not sure I understand, but perhaps you want this:

SELECT 54,
   x.item_id,
(SELECT valueInt FROM metadata_value WHERE mdv.item_id = 20202) AS valueInt
FROM (
   SELECT 20203 AS item_id
   UNION ALL SELECT 20204
   UNION ALL SELECT 20205
   UNION ALL SELECT 20206
   UNION ALL SELECT 20223
   UNION ALL SELECT 20207
   UNION ALL SELECT 20208
) AS x;

I don't think you're gaining anything by doing this though, unless it is extremely expensive to do a lookup in item.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to