且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

关于在学校工作的sql server企业进程

更新时间:2023-02-02 23:37:10





首先,您需要确定您有多少面额,以及您有多少种面额? ?



例如:500卢比可分为单个500卢比纸币,5卢比纸币,50个十卢比纸币等。



如果您知道wat将是面额的数量,那么您可以将它们作为常量存储在程序中,然后编写一个查询来划分金额。



ex:



Hi,

First you need to decide how many denominations do you wana have and how many kinds of denominations do you wana have?

For ex: a 500 rupee can be divided into a single 500 rupee note, 5 hundred rupee notes, 50 ten rupee notes and so on.

If you know wat will be the number of denominations then you can have them as constants in your stored procedure and then write a query which will divide the amount.

ex:

create table tblDenominations(

Numberof500 int,
Numberof100 int,
Numberof50 int,
Numberof10 int,
Numberof5 int,
Numberof1 int)





对于一个场景,让我们插入一行。





For a scenario, let us insert a row.

Insert into dbo.tblDenominations values(5,2,4,5,9,5)





现在如果你想分数3000,然后你可以有

5 * Numberof500 + 2 * Numberof100 + 4 * Numberof50 + 5 * Numberof10 + 9 * Numberof5 + 5 * Numberof1



Ho你可以从上面的场景中得到一些想法。



问候

anurag



Now if you want to divide a amount say 3000, then you can have as
5*Numberof500 + 2*Numberof100 + 4*Numberof50 + 5*Numberof10 +9*Numberof5 +5*Numberof1

Hope you get some idea from the above scenario.

Regards
anurag


假设你的工资单表格是这样的

suppose your payroll table is like this
TransId  EMP_NO PAID_AMT PAID_DATE
------------------------------------
1        1      10000    20-02-1013



创建另一个表 NoteDetails


create another table NoteDetails

TransId NoteValue NoOfNotes
----------------------------------------------
1       500       18                                500 * 18 = 9000
1       100       10                                100 * 10 = 1000
1       50        20                                 50 * 20 = 1000
                                                   ------------------
                                                              10000



快乐编码!

:)


Happy Coding!
:)