You are here: Re: sorting table while inserting « MsSQL Server « IT news, forums, messages
Re: sorting table while inserting

Posted by Oonz on 05/29/07 16:42

On May 29, 9:27 pm, Jason Lepack <jlep...@gmail.com> wrote:
> What exactly do you want to do? Maybe there is a better way of doing
> it that you haven't come across.
>
> Give a little more detail and more help can be given.
>
> Cheers,
> Jason Lepack
>
> On May 29, 12:24 pm, Oonz <arund...@gmail.com> wrote:
>
>
>
> > On May 29, 9:19 pm, Jason Lepack <jlep...@gmail.com> wrote:
>
> > > Tables don't store data in a logical order. They store data in a
> > > physical order. If you want to see data in an ordered fashion then
> > > create a view to do that. Also, Name is a reserved word, don't use
> > > it...
>
> > > SELECT
> > > No,
> > > NameField,
> > > Phone
> > > FROM
> > > yourTable
> > > ORDER BY
> > > No, NameField, Phone
>
> > > Cheers,
> > > Jason Lepack
> > > On May 29, 12:04 pm, Oonz <arund...@gmail.com> wrote:
>
> > > > Hi Friends,
>
> > > > How can we insert records in sorted order
>
> > > > like consider a table
>
> > > > No Name Phone
> > > > 1 test1 12345
> > > > 1 test1 23455
> > > > 2 test2 68638
> > > > 3 test3 67684
> > > > 4 test4 54808
> > > > 4 test4 74594
>
> > > > if i add a new record like this
>
> > > > 2 test2 34454
>
> > > > it should go in specific order. so that the final table should look
> > > > something like this
>
> > > > No Name Phone
> > > > 1 test1 12345
> > > > 1 test1 23455
> > > > 2 test2 34454
> > > > 2 test2 68638
> > > > 3 test3 67684
> > > > 4 test4 54808
> > > > 4 test4 74594- Hide quoted text -
>
> > > - Show quoted text -
>
> > But actually i want to do further processing with that sorted table.
> > Thats why i am in need of such structure
>
> > Thanks
> > Arunkumar.D- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


Actually i will combine the multiple numbers into one single record

the temporary table structure would be like this

No Name Phone FinalPhone
1 test1 12345 12345
1 test1 23455 12345<br> 23455
2 test2 68638 68638
2 test2 34454 68638<br> 34454<br>
2 test2 45445 68638<br> 34454<br> 45445
3 test3 67684 67684
4 test4 54808 54808
4 test4 74594 54808<br> 74594


and by using GROUP BY clause i would select single record having all
the
information


No Name FinalPhone
1 test1 12345<br> 23455
2 test2 68638<br> 34454<br> 45445
3 test3 67684
4 test4 54808<br> 74594

this view would be sent to UI for display...

Thanks
Arunkumar.D

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация