cucumber Posted July 20, 2006 Report Share Posted July 20, 2006 Ir tablula , kura ir User Logtime User Logofftime un ir vajadzigs ieksh query aprekinat Logofftime - Logtime WHERE user='aaa' ? Ar kadu f-ju palidzibu tas ir iespejams Link to comment Share on other sites More sharing options...
Delfins Posted July 20, 2006 Report Share Posted July 20, 2006 1.) kāda DB? 2.) sava f-ja (storētā vai php-iska/etc) Link to comment Share on other sites More sharing options...
cucumber Posted July 20, 2006 Author Report Share Posted July 20, 2006 ieksh mysql pie query m jau aprekinat, paliek tik izvadit Link to comment Share on other sites More sharing options...
v3rb0 Posted July 20, 2006 Report Share Posted July 20, 2006 select Logofftime - Logtime as N from users WHERE user='aaa' tak varēja izpildīt? Link to comment Share on other sites More sharing options...
cucumber Posted July 20, 2006 Author Report Share Posted July 20, 2006 Ne biku savadak +---------+-----------------------+ - Users - Data - +---------+-----------------------+ - abc - 2006-07-12 20:21:20 - start time - c - - abc - 2006-07-13 10:21:20 - end time - k - - abc - 2006-07-14 08:11:20 - start time - abc - 2006-07-14 10:21:20 - end time +---------+------------------------+ sql vienmer bus abi laiki, tapec vajaga dabut piem usera abc kopigo laiku, cik kopa vinsh ir bijis sistema ? Link to comment Share on other sites More sharing options...
litt Posted July 20, 2006 Report Share Posted July 20, 2006 Es būtu rakstījis abus laikus vienā rindiņā. Ja Tu tā nedari, tad vismaz pieliec papildus pazīmi vai konkrētais laiks ir start vai end laiks Link to comment Share on other sites More sharing options...
v3rb0 Posted July 20, 2006 Report Share Posted July 20, 2006 vai arī sessijas_id pielikt, jo citādi vienozīmīgi neatšķirsi kurš ieraksts ir kurai sessijai. sākumu un beigas var ar min un max atrast. select session_id, user, SEC_TO_TIME(unix_timestamp(session_end)-unix_timestamp(session_start)) as session_time from ( select session_id, user, min(data) as session_start, max(data) as session_end from test where user='abc' group by session_id ) as t Link to comment Share on other sites More sharing options...
Delfins Posted July 20, 2006 Report Share Posted July 20, 2006 Es piemēram nelietoju fīču "Logoff".. ;) Tā kā neredzu jēgu šitam ciparam... Taisi tā kā forumā, user tabulā updeito LastSeenTime lauku... Link to comment Share on other sites More sharing options...
Recommended Posts