最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

mysql-MySql查詢的問(wèn)題,關(guān)于庫(kù)存量的查詢操作

來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-09 16:36:21
文檔

mysql-MySql查詢的問(wèn)題,關(guān)于庫(kù)存量的查詢操作

mysql-MySql查詢的問(wèn)題,關(guān)于庫(kù)存量的查詢操作:mysqlselect CREATE TABLE who_tmp_real_stock2 SELECT SUM( num ) AS real_stock,goods_id AS goods_id_new FROM who_goods_stock GROUP BY goods_id_new ALTER TABLE who_tmp_real_stock2 ADD UNIQUE (goods_id_new) SELECT a.goods_id as goods_id,c
推薦度:
導(dǎo)讀mysql-MySql查詢的問(wèn)題,關(guān)于庫(kù)存量的查詢操作:mysqlselect CREATE TABLE who_tmp_real_stock2 SELECT SUM( num ) AS real_stock,goods_id AS goods_id_new FROM who_goods_stock GROUP BY goods_id_new ALTER TABLE who_tmp_real_stock2 ADD UNIQUE (goods_id_new) SELECT a.goods_id as goods_id,c

mysqlselect

CREATE TABLE who_tmp_real_stock2
SELECT SUM( num ) AS real_stock,goods_id AS goods_id_new
FROM who_goods_stock
GROUP BY goods_id_new
ALTER TABLE who_tmp_real_stock2
ADD UNIQUE (goods_id_new)
SELECT a.goods_id as goods_id,cat_id, d.real_stock, a.goods_sn as goods_sn,goods_name,keywords,is_on_sale,is_delete,
is_best,is_new,is_hot,is_promote,shop_price*100 as shop_price,(shop_price*6.3-in_price)*1000 as profit,
last_update,goods_number,goods_material,goods_color,b.goods_sku_value,customer_rate_num,
(c.sale_num*15+c.stock_num*2) as stock_num,pattern_value,a.add_time

from who_goods_desc b,
who_privilegestocknum c,
who_goods a LEFT JOIN
who_tmp_real_stock2 d ON a.goods_id=d.goods_id_new

where a.goods_id=b.goods_id and
a.goods_id=c.goods_id and
a.goods_id>0 and
c.stock_num>0 and
is_on_sale=1 and
is_delete=0 and
is_freeshipping=0 and
a.goods_number>0
select a.*
from who_goods a
where a.goods_id=$id

SELECT a.goods_id AS goods_id, cat_id, a.goods_sn AS goods_sn, goods_name, keywords, is_on_sale, is_delete,
is_best,is_new, is_hot, is_promote, shop_price *100 AS shop_price, last_update, goods_number, goods_material,
goods_color, pattern_value, c.real_stock
FROM who_goods AS a,
who_goods_desc AS b LEFT JOIN who_tmp_real_stock c ON b.goods_id=c.goods_id_new

WHERE a.goods_id = b.goods_id
AND is_on_sale =1 AND
is_delete =0 AND
is_freeshipping =0 AND
a.goods_number >0
想獲取庫(kù)存量大于0的商品信息,不知道這個(gè)sql是不是

聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

mysql-MySql查詢的問(wèn)題,關(guān)于庫(kù)存量的查詢操作

mysql-MySql查詢的問(wèn)題,關(guān)于庫(kù)存量的查詢操作:mysqlselect CREATE TABLE who_tmp_real_stock2 SELECT SUM( num ) AS real_stock,goods_id AS goods_id_new FROM who_goods_stock GROUP BY goods_id_new ALTER TABLE who_tmp_real_stock2 ADD UNIQUE (goods_id_new) SELECT a.goods_id as goods_id,c
推薦度:
  • 熱門(mén)焦點(diǎn)

最新推薦

猜你喜歡

熱門(mén)推薦

專題
Top