Questions tagged «money»


3
高效比较不同货币的价格
我想让用户可以在一个价格范围内搜索产品。无论产品设置哪种货币,用户都应该能够使用任何货币(美元,欧元,英镑,日元,...)。因此,产品价格为200美元,并且,如果用户搜索价格在100欧元至200欧元之间的产品,他仍然可以找到它。如何使其快速有效? 这是我到目前为止所做的。我保存price,currency code而calculated_price这是在欧元(EUR)的价格是默认货币。 CREATE TABLE "products" ( "id" serial, "price" numeric NOT NULL, "currency" char(3), "calculated_price" numeric NOT NULL, CONSTRAINT "products_id_pkey" PRIMARY KEY ("id") ); CREATE TABLE "currencies" ( "id" char(3) NOT NULL, "modified" timestamp NOT NULL, "is_default" boolean NOT NULL DEFAULT 'f', "value" numeric NOT NULL, -- ratio additional …
10 postgresql  money 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.