-
how to select query to find bonus ,qtd sold for that period ?
am facing a problem with a queryto find the item info , for all the item sold , bonus qty
I have a table trans with the following
columns
item_code varchar2(20)
slt_code varchar2(10)
invoice_date date
sa_amount number(25,10)
qty_sold number (25,10)
fy_year number(4)
fyp_seq number(2)
where item_code is the name of item
slt_code is the type of sales , it can be C or B (c being cash and b being bonus )
invoice_date is the date
sa_amount is the cost of the the items sold
qty_sold is the quantity sold of the item(depending on whether its C, or B)
fy_year indicates the year
fyp_seq indicates the period
example of table data
PHBI0 C 24-MAR-08 20 12 2008 3
PHBI0 B 28-MAR-08 0 10 2008 3
PHBI0 C 24-FEB-08 10 10 2008 2
problem is to display the
item_code , cost of the item(this should contain only belonging to slt_code C), qty_sold (again belonging to slt_code c), bonus quantity(belonging to slt_code =B) , ytd_qty( this should total all the qty of the particular item upto the current period for the slt_code =C)
so if i run a query for the item_code PHBIO for the period of march
i should get the result as
PHBI0,20,12,10,22
I have all this info from just one table , is there a way out
-
John,
According to your requirements, you may be missing some table(s) holding the cost of the item and bonus quantity.
Show us your query, describe all tables,...
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|