Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Select Help FIFO METHOD

Author  Topic 

DENIZ3E
Yak Posting Veteran

56 Posts

Posted - 2005-11-29 : 06:13:23
HI,
FIFO METHOD (FIRST IN FIRST OUT)
I have got a table. EXAMPLES I have bought 10 A s after this I have bought 20 more.after I have bought 10 more.
FIRST TABLE (IN)
--------
stok AMOUNT PRICE date_ I/0 (IN/OUT)
----- ------ ---- ---------- -----
A 10 1 01.01.2005 I
A 20 1,5 10.01.2005 I
A 10 1,4 10.01.2005 I
A 10 ?? 10.01.2005 O
A 25 ?? 10.01.2005 O


after this I have sold 5 A and I WANT THIS SEILING TO BE PRICE IDENTIFIED BUY FIFO(FIRST IN FIRST OUT) METHOD.

EXAMPLE






A
IN OUT
---- ----------------------------
01.01.2005 10 1 10.01.2005 10 ---(1)

------------------------------------------------------------------
01.01.2005 20 1,5 10.01.2005 25----20=1,5 AND 5=1,4

cfederl
Starting Member

26 Posts

Posted - 2005-11-29 : 10:10:15
Joe Celko has written 2 article on implimenting FIFO and LIFO with SQL.

http://www.dbazine.com/ofinterest/oi-articles/celko32
http://www.dbazine.com/ofinterest/oi-articles/celko33

Carl Federl
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-11-29 : 14:00:59
Got a DEFAULT datetime column or an IDENTITY column on the table...Read the hint link at the bottom and post what ity asks for.



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

DENIZ3E
Yak Posting Veteran

56 Posts

Posted - 2005-11-29 : 18:06:18
PLEASE HELP....
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-11-29 : 20:09:15
Sure, please help us help you...read the hint link


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

DENIZ3E
Yak Posting Veteran

56 Posts

Posted - 2005-11-30 : 09:16:30
please help...
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-11-30 : 09:39:58
well deniz3e.... have you read the articles provided by cfederl??
is there anything you don't understand that's written in them???
they seem like good articles to me...
you don't expect that someone wil simply do all your work for you, do you?


Go with the flow & have fun! Else fight the flow
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-11-30 : 11:17:12
Wow ... it's amazing isn't?

We've got dozens of SQL experts here willing to help others with free advice, and the only catch is that you need to actually ask a clear, specific question, and make some effort to explain your problem. Yet, for many people, that's asking too much.

It's like if you had a magic genie that could grant you any wish, but of course, you need to be clear about what you want. For some people, they'd say, "I can have absolutely anything I want in the whole world, I just have to be specific and clear about it? nah .. that's too much trouble, not worth it."
Go to Top of Page
   

- Advertisement -