Hi Everyone,
Here i need your help, and this is my table - CREATE TABLE cont (contnumber VARCHAR2(10), rcptnum NUMBER, rcptamount NUMBER);
-
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('a123', 1, 120
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('a123', 2, 260
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('a123', 3, 300
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('a123', 4, 380
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('q123', 1, 1000
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('q123', 2, 1500
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('q123', 3, 2000
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('q123', 4, 3500
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('z123', 1, 150000
-
);
-
INSERT INTO cont
-
(contnum, rcptnum, rcptamt
-
)
-
VALUES ('z123', 2, 220000
-
);
-
COMMIT ;
I Want The Output In SQL, - contnumber rcptamount
-
a123 100
-
a123 200
-
a123 300
-
q123 1000
-
q123 2000
-
q123 3000
-
z123 100000
-
z123 200000
That mean if 'rcptamount' in 100s, it should show as 100 ,200,300, if rcptamount in 1000s ,
it should show as 1000,2000,3000,if it is in lakhs ,it should be, 100000,200000 .
Please suggest me if there is any way in SQL.
I want like this ,take one 'contnum' for example, - contnum | rcptnum | rcptamt
-
-----------------------------
-
a123 | 1 | 120
-
a123 | 2 | 130
-
a123 | 3 | 180
-
a123 'Contnum' having Three 'rcptnum' 1,2 and 3. those 'rcptamt' in 100s like 120,130 and 180.
the contnum a123 having rcptamts in 100s,
so i need to display as - contnum | rcptamt
-
----------------
-
a123 | 100
Thank You.
1 1218
I don't use oracle but I can give you the algorithm I would use.
1) Convert to a string if necessary. Some SQL engines require this, some do it automatically.
2) Take the first left character.
3) Append zeroes for the length of the string minus one.
4) Take the distinct of the results.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rama S |
last post by:
Hi,
We need a query which retrieves option_code, for a plan from OPTION
table which are unique in (market, "ALL").
I have an example below
PLAN MARKET OPTION_CODE RATE...
|
by: PenBlast |
last post by:
I need a SQL query that will return row1 and 2. The rule would be "2
(and only 2) occurences of Store_Number where Forms_Count is not the
same.
Store_Number Forms_count
3 5
3 ...
|
by: bmoos1 |
last post by:
I need to make a Report of all people starting in 2004 by "Date
Requested". Dates are entered as mm/dd/yyyy. I have a query that has
all the people that started in 2004, but there are numerous...
|
by: write2ashokkumar |
last post by:
hi..
i have query like this..
select id,name from tbl where id in(5,2,4,1,3);
When i execute the above query.. i get the result set with ascending order by id
by default....
|
by: jennk |
last post by:
i am working in Access 97, our database tables are linked from ODBCsqlsvr (not even sure what that means). i have a table where each record has a unique customer and their order information. there...
|
by: Terry Olsen |
last post by:
I have two tables each with one column of serial numbers. I need a query
that will return only the serial numbers from Table1 that aren't in
Table2. I need it to also return the serial numbers from...
|
by: write2ashokkumar |
last post by:
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
id ------------ name
|
by: write2ashokkumar |
last post by:
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
----------------
|
by: write2ashokkumar |
last post by:
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
----------------
|
by: karuppiah |
last post by:
Hi All,
i need query,how to select last 3 month ,last 3wek,last 3 days , this last 3 month and 3 week should be friday, using sysdate from dual table, there is no exsting table, pls any one help...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| | |