Reply to Re: Need More SQL Query NewID Help

Your name:

Reply:


Posted by Paradyse on 07/08/06 01:09

I removed the DISTINCT and it showed the same record 10 times. Who is
Hugo?

"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns97FA1AC01EC0Yazorman@127.0.0.1:

> Paradyse (support@paradysed.com) writes:
> > Excuse my ignorance because I don't do advance db related programming,
> > but have no other choice at the moment. My experience is limited to
> > simple queries.
> >
> > I need to have the following query display the recordset in random order
> > based on RecordID (unique key) if possible. I tried the ORDER BY NewID()
> > at the end and it generated an error (ORDER BY items must appear in the
> > select list if SELECT DISTINCT is specified.) I guess because of the sub
> > query. I would also like for the recordset to display a different 10
> > records on each hit to the page, not just the same 10 records in random
> > order. I wasn't sure if the SELECT commands I have in place are
> > sufficient for this task.
>
> Hugo has already asked why you have the DISTINCT there. Have you tried
> simply to remove it?
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original 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

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