A
A
Andrello2014-04-10 21:04:58
MySQL
Andrello, 2014-04-10 21:04:58

How to fetch from MySQL?

SELECT `plug_cat_join_cat_item`.`id` as cii, `plug_cat_join_cat_item`.`item` as jjj FROM `plug_cat_join_cat_item`
  JOIN (SELECT `write_id`,`attr` FROM `plug_cat_vals` ) as ch ON ch.`write_id` = `plug_cat_join_cat_item`.`id`
      LIMIT 64,8

There is a plug_cat_join_cat_item table with perhaps not relevant product ids, I need to select from it only those products (let's say 8 pieces) for which there is an entry in the plug_cat_vals table, i.e. at fetch time, check for the presence of attributes in the plug_cat_vals table.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Confl1kt, 2014-04-10
@Andrello

SELECT item.* 
FROM plug_cat_join_cat_item item
LEFT JOIN plug_cat_vals val ON val.write_id = item.id
WHERE val.write_id IS NOT NULL
LIMIT 64, 8

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question