Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Re: SELECT DISTINCT ROW 1


Message #1 by Roland Boorman <r_boorman@y...> on Thu, 1 Feb 2001 01:47:38 -0800 (PST)
Brad, I'm not sure there is a useful purpose for doing that.  Now() is a 
function in vba to return the current date/time, but you can use "now" as 
an alias for a field name in a query.  Why this is done in your particular 
application, I do not know.  If you want to see the results of the query, 
simply cut and paste the sql command into the "SQL View" of a new Query in 
the Access database and run it.

-g

-----Original Message-----
From:	Brad Carroll [SMTP:bradc@c...]
Sent:	Sunday, February 04, 2001 4:20 PM
To:	sql language
Subject:	[sql_language] Re: SELECT DISTINCT ROW 1

Thanks for your help so far.

Is this what you mean?:

NOW     ID     FIRST NAME     LAST NAME
----------------------------------------
1       1234   John           Doe
1       4567   Mary           Smith
1       7898   etc.           etc.


What would be the useful purpose of doing this?  I found it especially
confusing as I am more used to using VB and ADO/DAO to do all my database
stuff, and using the term "Now" would normally mean "output the current
time and date".

I'm thinking that maybe the "1" is being used to indicate "TRUE"... would
that be right?

My first guess about how the query worked was that it returned the first
row from each referenced table (or the first that matched the search
criteria, anyway) and then created a column called "NOW" and put the
current time and date in that column.  Obviously this is not correct.  Is
there some way to view the table that is created?  It is currently not set
up to put the actual table on the screen for me to view the results (the
results are sent to a report, with lots of things happening behind the
scenes).

> The "1" has nothing to do with the DISTINTROW clause, it's a constant
> expresion for a column called NOW.  every row will start with  column 
"NOW"
> with the value 1 in it.
>
> -g
>
>
> -----Original Message-----
> From:	John Pirkey [SMTP:mailjohnny101@y...]
> Sent:	Wednesday, January 31, 2001 12:48 PM
> To:	sql language
> Subject:	[sql_language] Re: SELECT DISTINCT ROW 1
>
> what database is thig used in? SQL Server, Oracle, Access, FoxPro, DB2???
>
> i've never seen it either, but i've only dealt with SQL Server.
>
> --- Brad Carroll <bradc@c...> wrote:
> > Hi,
> >
> > If anyone can help me with this I'd be very grateful.  Recently I have
> > inherited a number of terrible undocumented and very complex databases 
to
> > maintain.  These databases not only have no documentation whatsoever in
> > any form, but they are also FULL of bugs and problems.  Fixing these
> > problems has not been easy, I can tell you!
> >
> > Anyway, I have come accross this SQL command I've never seen used 
before
> > and hope someone can tell me what it means.
> >
> > It goes:
> >
> > SELECT DISTINCTROW 1 AS NOW, [Employee Details].[Hours], [etc].[etc]
> >
> > and so on.  So what does the "1" mean?  This is probably very basic 
stuff
> > that every SQL programmer should know, but OK, I admit I don't know! 
 So
> > if someone can help me that would be great.
> >
>
> John Pirkey
> MCSD
> John@S...
> http://www.stlvbug.org

  Return to Index