Groups | Search | Server Info | Login | Register


Groups > comp.databases > #88

Re: joining tables and the order changes

From Ben Finney <bignose+hates-spam@benfinney.id.au>
Newsgroups comp.databases
Subject Re: joining tables and the order changes
References <96356369-58eb-4a52-a72b-1687558871e1@e17g2000prj.googlegroups.com>
Date 2011-06-23 07:47 +1000
Message-ID <8739j1pmhb.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


shawrie <tourerukcom@googlemail.com> writes:

> When i display records from deal basket for a specific deal number it
> displays the record fine. When i create a view and link the 2 tables
> by product code so i can display description the order of records
> change????

One possibility is that the problem is caused by too many question
marks :-)

Another is that you've forgotten that SQL result sets are allowed to
come back in *any* order, and can change from one moment to the next,
unless you use an ‘ORDER BY’ clause.

> How can i display the records in the dealsbasket in the order they
> were imported into the table

The RDBMS has no obligation to even remember what order they were
inserted into the table. Most will not, instead optimising storage
internally for speed purposes.

If you want the records to have a particular sequence, then you need
them to have a field which can be the subject of an ‘ORDER BY’ clause.
Likely candidates are the real-world identifier for the product or deal.

-- 
 \       “Following fashion and the status quo is easy. Thinking about |
  `\        your users' lives and creating something practical is much |
_o__)                                harder.” —Ryan Singer, 2008-07-09 |
Ben Finney

Back to comp.databases | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

joining tables and the order changes shawrie <tourerukcom@googlemail.com> - 2011-06-22 07:44 -0700
  Re: joining tables and the order changes Ben Finney <bignose+hates-spam@benfinney.id.au> - 2011-06-23 07:47 +1000
  Re: joining tables and the order changes Arthur Ward <art.ward@noreply.xx> - 2011-06-23 08:50 +0000
    Re: joining tables and the order changes David Kerber <dkerber@WarrenRogersAssociates.invalid> - 2011-06-23 09:09 -0400
      Re: joining tables and the order changes Arthur Ward <art.ward@noreply.xx> - 2011-06-23 13:23 +0000
        Re: joining tables and the order changes David Kerber <dkerber@WarrenRogersAssociates.invalid> - 2011-06-23 14:35 -0400
    Re: joining tables and the order changes toledobythesea@yahoo.ca - 2011-06-24 10:40 -0700
      Re: joining tables and the order changes Arthur Ward <art.ward@noreply.xx> - 2011-06-25 12:33 +0000
        Re: joining tables and the order changes paul c <toledobythesea@yahoo.ca> - 2011-06-25 14:44 -0700
        Re: joining tables and the order changes paul c <toledobythesea@yahoo.ca> - 2011-06-25 14:53 -0700
          Re: joining tables and the order changes Lee Fesperman <firstsql@gmail.com> - 2011-07-04 00:39 -0700

csiph-web