| Author |
Topic |
|
jeffliew
Starting Member
6 Posts |
Posted - 2005-08-29 : 02:01:59
|
| i hv a problem in sql,i) if in data hv time_start, time_end, date , id, how i can calculate the total time for very sesion user loginii) how to make it if the total come out hv same id(may be two id hv two diffrent total), i want make it just one id then the total time...post me at jeffliew2001@yahoo.com |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-29 : 02:27:04
|
| Post table structure, some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
kapilarya
Yak Posting Veteran
86 Posts |
Posted - 2005-08-29 : 02:54:31
|
quote: Originally posted by jeffliew i hv a problem in sql,i) if in data hv time_start, time_end, date , id, how i can calculate the total time for very sesion user loginfor this you can do the DATEDIFF ( datepart , startdate , enddate ) ii) how to make it if the total come out hv same id(may be two id hv two diffrent total), i want make it just one id then the total time...Post data and table structure post me at jeffliew2001@yahoo.com
Kapil Arya |
 |
|
|
jeffliew
Starting Member
6 Posts |
Posted - 2005-08-29 : 11:57:54
|
| This is the table struture Student_ID , Hostname, IP_Adress, Time_Start , Time_End, Date ,Total_Timesample data Student_id Hostname IP_Adress TimeStart Time_end Date Total_TimB030210245, pc2, 12.5.8.9, 4.00pm, 6.00pm, 8/21/2005, 2HoursB030210246, computer, 12.1.1.1, 11.00am, 4.00pm , 8/22/2005, 5HoursB030210246, pc1, 12.1.1.4, 8.00am, 12.30pm , 8/22/2005,4.30Hoursso in the following i give it, i wan to know how to get the total_time, after this i wan make ID B030210246 to be one line like example:Student_id TotaltimeB030210246 9.30Hours |
 |
|
|
jeffliew
Starting Member
6 Posts |
Posted - 2005-08-29 : 12:02:22
|
| This is the table struture Student_ID , Hostname, IP_Adress, Time_Start , Time_End, Date ,Total_Timesample data Student_id Hostname IP_Adress TimeStart Time_end Date Total_TimB030210245, pc2, 12.5.8.9, 4.00pm, 6.00pm, 8/21/2005, 2HoursB030210246, computer, 12.1.1.1, 11.00am, 4.00pm , 8/22/2005, 5HoursB030210246, pc1, 12.1.1.4, 8.00am, 12.30pm , 8/22/2005,4.30Hoursso in the following i give it, i wan to know how to get the total_time, after this i wan make ID B030210246 to be one line like example:Student_id TotaltimeB030210246 9.30Hours |
 |
|
|
jeffliew
Starting Member
6 Posts |
Posted - 2005-08-29 : 12:03:19
|
| This is the table struture Student_ID , Hostname, IP_Adress, Time_Start , Time_End, Date ,Total_Timesample data Student_id Hostname IP_Adress TimeStart Time_end Date Total_TimB030210245, pc2, 12.5.8.9, 4.00pm, 6.00pm, 8/21/2005, 2HoursB030210246, computer, 12.1.1.1, 11.00am, 4.00pm , 8/22/2005, 5HoursB030210246, pc1, 12.1.1.4, 8.00am, 12.30pm , 8/22/2005,4.30Hoursso in the following i give it, i wan to know how to get the total_time, after this i wan make ID B030210246 to be one line like example:Student_id TotaltimeB030210246 9.30Hours |
 |
|
|
JimL
SQL Slinging Yak Ranger
1537 Posts |
Posted - 2005-08-29 : 14:50:01
|
| 1st problem is that your useing time_start, time_end, date what happens when it runs through 11:59 PM?Time_start and Time_end should be in full datetime format this will allow you to use date diff.JimUsers <> Logic |
 |
|
|
|
|
|