Query to display salary in words

This is a discussion on "Query to display salary in words" within the Databases section. This forum, and the thread "Query to display salary in words are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 14th, 2007, 06:51
Junior Member
Join Date: Apr 2007
Location: India
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Query to display salary in words

Hi all,

I need to write a query which fetch the salary of employee and displays it.

select emp_id,salary from emp_details

Result:
emp_id salary
1 5000
2 6000

Now i want the salary to be displayed like this.
For eg. Five thousand hundred instead of 5000

i know that it can be done in oracle. is it possible to do this in Mysql?

Thanks,
Thanuja.
Reply With Quote

  #2 (permalink)  
Old Jun 17th, 2007, 05:09
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Query to display salary in words

I think that Oracle's to_char may be unique - it's certainly unusual and it's a classic "interview question" for Oracle dba-s - see here.

You can do it at the program level once you have the number extracted easily enough - again it's not built in but code is available in many languages. See
PHP solution
Java Solution
Perl solution
Reply With Quote
  #3 (permalink)  
Old Jun 18th, 2007, 06:38
Junior Member
Join Date: Apr 2007
Location: India
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Query to display salary in words

Thanks grahme. so Mysql does not have any function to do this right?

Regards,
Thanuja.
Reply With Quote
  #4 (permalink)  
Old Jun 19th, 2007, 05:01
Junior Member
Join Date: Jun 2007
Location: Los Angeles
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Query to display salary in words

Here is a PHP function class that will do that - maybe you can use it even tho it's not a built-in MySQL function.

http://articles.techrepublic.com.com...1-5193528.html

RalphF
GoldRushWebHosting.com

Last edited by karinne; Jun 22nd, 2007 at 12:09. Reason: No advertising please! Read the sig rules!
Reply With Quote
Reply

Tags
words

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
regardind see-saw moment of words pushpendramadan Website Planning 5 Jan 7th, 2008 04:48
Help with key words Wombat Starting Out 4 Jul 17th, 2007 08:10
Gre words and vocabulary builder hawashp Free Web Site Critique 7 May 25th, 2007 08:33
Weird IE Bug - repeating words Andy K Web Page Design 5 Mar 5th, 2006 12:23
write words on pictures jenjen1018 Web Page Design 10 Dec 19th, 2003 18:17


All times are GMT. The time now is 01:38.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43