• Post Reply Bookmark Topic Watch Topic
  • New Topic

more than one values for a single message  RSS feed

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to get the values from database in ascending order.I will explain you in detail.I have two columns in my mysql table "ivr". The first column is messages and the second column is order_no.like the following

message order_no

welcome 1
Thank you 4
How are you 3
bob 2



Here The messages should be printed in order by order_no like
welcome
bob
How are you
Thank you.
This is perfect. But if I need to give two order numbers for one message like ,For the message bob I need to give the order number 2 and also 5, How should i store the order number in database?Can i store it like 2,5?Is it possible?

Thanks

 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way i can think of is having two entries in the table one as [bob,2] and the other as [bob,5].
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. You mean i have to insert the fields two times.first for the value 1 and the other for the value 5?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that's what i meant. Look out for other suggestions also. But this is the only possibility i see.
 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want to print bob twice at different places in your program, why you have to make another entry in table?
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then how should i do this. If i insert two times bob and its order number,i can able to print the bob in the locations according to the order number.

 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
preethi Ayyappan wrote:Then how should i do this. If i insert two times bob and its order number,i can able to print the bob in the locations according to the order number.



that was acceptance or a question? I assumed you need to print bob more than once in different places. If it is not, then explain it again.
 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I think I am getting your point. Can you put in hshmap, where keys are order and values are your messages?
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. you got my point.can you please explain me in brief? How to put in hashmap?I have no idea about that
 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
preethi Ayyappan wrote:How to put in hashmap?I have no idea about that


I fyou don't want to make another entry in table, then you need to hardcode the order for your corresponding message, that second bob will always come in 5th position. here 5 will be the key and bob will be the value. Something like that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!