【发布时间】:2009-03-16 20:21:45
【问题描述】:
我以前写过这个函数,但我好像不记得了,它也没有进入版本控制。现在,更多的是与睡眠剥夺有关,我不记得如何重建它。
这就是想法。我有两个表,“regPrice”和“custPrice”,共享密钥“itemID”。它们都有一个“价格”列,并且 custPrice 也有另一个键“acct”,因此如果 custPrice 中存在价格,它应该返回那个。如果没有 custPrice 条目,它应该返回 regPrice。
伪代码:
if(select custPrice where acct = passedAcct and itemID = passedItemID) {
return custPrice;
else
return regPrice;
任何帮助将不胜感激。
【问题讨论】:
标签: sql mysql stored-procedures join