-1

I want to get values of c.cf_condition, c.cf_condition_value and c.cf_warranty from table 2. These attributes are not in table 1. I used every join condition but nothing happened. These values can be show with inner join but without WHERE p.cf_IsDailyDeal=1 condition. If i am not right this where clause then my required rows not shown. I want to fetch three attributes but with this where clause:

SELECT p.im_folder,
p.im_name,
p.cf_price_check,
p.category_id,
p.classifieds_id,
p.cf_price_check,
p.classifieds_id,
p.cf_title,
p.cf_addeddate,
p.cf_price,
(SELECT c.cf_condition FROM as_classifieds as c WHERE c.classifieds_id = p.classifieds_id),
(SELECT c.cf_condition_value FROM as_classifieds as c WHERE c.classifieds_id = p.classifieds_id),
(SELECT c.cf_warranty FROM as_classifieds as c WHERE c.classifieds_id = p.classifieds_id)
FROM as_index_classifieds as p 
WHERE p.cf_IsDailyDeal=1;
Anders
  • 8,307
  • 9
  • 56
  • 88
  • You can look [here](http://stackoverflow.com/questions/12364602/mysql-inner-join-with-where-clause) or [here](http://stackoverflow.com/questions/18153665/inner-join-where-clause) for answers – SirHenry Oct 07 '15 at 08:46
  • I can not understand your question. An attempt at clarification might be useful, perhaps with some sample data. – Anders Oct 07 '15 at 09:14
  • i want to get values of columns c.cf_condition, c.cf_condition_value and c.cf_warranty from table 'as_classifieds' . these columns are not in table 'as_index_classifieds' , i use select query on 2nd table , i want these 3 values show when i echo those – Ali Iqbal Oct 07 '15 at 12:07

1 Answers1

0

I'm not sure what you are looking for, ¿this is not working for you?

SELECT 
p.im_folder,
p.im_name,
p.cf_price_check, 
p.category_id,
p.classifieds_id,
p.cf_price_check, 
p.classifieds_id,
p.cf_title, 
p.cf_addeddate, 
p.cf_price,
c.cf_condition, 
c.cf_condition_value, 
c.cf_warranty 
FROM as_index_classifieds as p 
LEFT JOIN as_classifieds as c 
ON p.classifieds_id = c.classifieds_id  
WHERE p.cf_IsDailyDeal=1;

This should give you those 3 attributes for the rows from table 1 with same id as table 2 where dailyDeal is 1

Mario Chueca
  • 116
  • 7
  • no i have tried this but c.cf_condition, c.cf_condition_value, c.cf_warranty not showing their values,,, i want these columns values .. – Ali Iqbal Oct 07 '15 at 12:02
  • Can you give some examples of your tables contents, of the 2 rows you want to mix. As Anders said, some sample data might help – Mario Chueca Oct 08 '15 at 08:17