Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date time

Author  Topic 

dionismatos
Starting Member

6 Posts

Posted - 2010-03-18 : 15:47:27
Hello all

I'm having issues with a query that selects a date.
i get the following error: Syntax error converting datetime from character string.

My query is this:

Select distinct c.empID, c.Nombres, c.Apellidos, rv.Horatotal, rv.horasextra, rv.feViaje, c.ceCosto
from Colaboradores c, ReporteViajes rv
Where (c.empID = rv.empID) and (rv.hstatus = 'S')
group by c.empID, c.Nombres, c.Apellidos, rv.Horatotal, rv.horasextra, c.ceCosto, rv.feViaje
UNION
select c.empID, c.Nombres, c.Apellidos, rv.Horatotal, rv.horasextra, c.ceCosto, rv.feViaje
from reporteAyudantes ra, Colaboradores c, ReporteViajes rv
Where (rv.idSeq = ra.idReporteViajes) and (c.empID = ra.empID) and (rv.hstatus = 'S')
group by c.empID, c.Nombres, c.Apellidos, rv.Horatotal, rv.horasextra, c.ceCosto, rv.feViaje

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-03-18 : 15:53:05
you have the last 2 fields out of order in the two select statements

"rv.feViaje, c.ceCosto"
"c.ceCosto, rv.feViaje"
Go to Top of Page
   

- Advertisement -