クエリ1の場合:つだけの行が示されている、SQL
select products
from buyde_deal
where displayflag = '1'
and end_date> now()
and start_date < now() limit 1
出力:
照会2:
SELECT id,productname ,cat_id ,subcat_id,shortdescription1,shortdescription2,shortdescription3 ,sellingprice,sellpricevat,mrp,regularprice,costprice,sku,qty,pweight,seller_id,shippingcost,color,size,discount
FROM `buyde_product`
WHERE id IN (
select products
from buyde_deal
where displayflag = '1'
and end_date> now()
and start_date < now())
ORDER BY `buyde_product`.`id` "
出力:
場合2番目のクエリを実行すると、1つのレコードのみが返されます。私は表1のすべての記録が必要です。
の可能性のある重複した[IN(とvarchar型の列で選択)状態とのint値の一部は、すべての行を返す](http://stackoverflow.com/questions/2064766/ select-by-varchar-column-in-part-in-condition-and-value-returns-all-r) –