[thelist] Dropping a view in SQL Server

Marios Andreas Tofarides matofarides at hotmail.com
Tue May 8 18:33:12 CDT 2001


> yes!!
> that is exactly what you said you wanted   =o)
> by the way, did you ever run that first query i sent?

Yes actually... but i don't want the error....


>   select theday=convert(char(10),timestamp,102),avg(value)
>     from yourtable
>    group by theday
>
> if this runs (using the column alias in the group by), you don't need the
> view
>
> if it doesn't, try
>
>   select theday=convert(char(10),timestamp,102),avg(value)
>     from yourtable
>    group by convert(char(10),timestamp,102)
>
> if that doesn't work either, then try the view

Thanx, but the view was what i needed.. You see I have another field in the
database named instrument... So I create the view selecting all three
objects
(theday, value and instrument) and then I do this:
Select avg(value) as a from theview where theday between mm/dd/yyyy and
mm/dd/yyyy and instrument = X group by theday

And the problem is the "theday between mm/dd/yyyy and mm/dd/yyyy"
comparison, because 'theday' is char. How can I make the comparison to work?

Marios





More information about the thelist mailing list