問個商品屬性與商品屬性值的有關問題

來源:互聯網
上載者:User
問個商品屬性與商品屬性值的問題?
商品表
goods_id cat_id productname price

屬性工作表
attr_id cat_id attr_name

屬性值表
id attr_id goods_id attr_value

在表單為修改時


saveData.asp
必須先刪除 delete * from [屬性值] where goods_id=2 and attr_id=3,然後insert into [屬性值](attr_id,goods_id,attr_value)values(...)

我看到ecshop是這樣的處理機制,諸位,怎麼看?必須這樣處理嗎?為何不可以 update [屬性值] set ......
------解決方案--------------------
這樣是一勞永逸 最簡單快捷的方法

要不然有添加、刪除屬性的時候,你做處理就要判斷哪些被刪除了?哪些新增了?哪些做修改了?
------解決方案--------------------
1.delete from tbname where goods_id=2 and attr_id=3
是沒有*

2.update from tbname set ……
這樣做也可以,關鍵你要找到需要修改的條件。

------解決方案--------------------
如果是同時修改多條記錄,一條一條的update,還不如一條insert語句同時插入多條記錄來的快吧。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.