查询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` "
输出:
如果我运行第二个查询,只返回一条记录。我需要表1中的所有记录。
的[通过VARCHAR列与IN()中的条件和int值返回所有行部分选择]可能的复制(http://stackoverflow.com/questions/2064766/ select-by-varchar-column-in-in-in-in-condition-and-int-value-returns-all -r) –