Sql

Forum for anything hard- or software related.

Moderator: Moderators

Post Reply
Gen
was flattened
Posts: 126
Joined: Tue Feb 10, 2004 11:06 pm
Location: cl
Contact:

Sql

Post by Gen »

I have this

Code: Select all

SELECT [Registros Consulta].Apellido_Paterno, [Registros Consulta].Apellido_Materno, [Registros Consulta].Nombres, [Registros Consulta].Ingreso, [Registros Consulta].Salida,  DateDiff("d",[Registros Consulta].Ingreso, [Registros Consulta].Salida) AS Dias, DateDiff("m",[Registros Consulta].Ingreso, [Registros Consulta].Salida) AS Meses, DateDiff("yyyy",[Registros Consulta].Ingreso, [Registros Consulta].Salida) AS Años
FROM [Registros Consulta];
but i want to know days, month, and years of difference betwen:
[Registros Consulta].Ingreso and [Registros Consulta].Salida
join date exit date
In my firecompany, we have an order , older to young, calculated in base of the time, that you have in the company, but you can join and exit many times and is necesary recalculate the time that you serve, and we have awards, for 10 20 30 40 50 60 and this year 70 years serving in the compañy, and this ystem is very usefull for recalculate it.
If some one never exit, then is neccesart using the actual date





Thx very much
Image
L0ki
didn't throw its grenade far enough
Posts: 323
Joined: Sat Aug 16, 2003 8:43 am
Location: de

Post by L0ki »

As far as I know there's no way doing this in SQL itself. I'd recommend javascript, vbscript or php for the calculation and you'll find very very many english/spanish/portguese tutorials about the calc of dates since it's a common "problem".
Post Reply