From: Anupam Karmarkar Date: June 20 2012 9:38am Subject: Need Query Help List-Archive: http://lists.mysql.com/mysql/227706 Message-Id: <1340185139.87173.YahooMailNeo@web193501.mail.sg3.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1439325297-1543822159-1340185139=:87173" ---1439325297-1543822159-1340185139=:87173 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi All,=0A=0AI need query help for following table struture, where we need = to calculate login duration of that employee for give period.=0A=0AExample = table=0A=0A=0AEmployeeID =A0=A0=A0 LoginTime=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0LogoutTIme=0A=0A101=A0=A0=A0 =A0=A0= =A0 =A0=A0=A0 =A0=A0=A0=A0 2012-05-01 10:00:00=A0 =A0=A0 2012-05-01 12:30:0= 0=0A102=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 2012-04-31 23:00:00=A0=A0= =A0 =A0 2012-05-02 05:00:00=A0 =0A=0A103=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0= =A0=A0=A0 2012-05-01 14:00:00=A0=A0=A0=A0=A0 NULL =A0=A0 =0A104=A0=A0=A0 = =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 2012-05-02 00:10:00=A0=A0=A0=A0=A0 2012-05= -02 05:00:00=0A=0A=0AI tried to fit all scenario in above table, Consider N= ULL as yet to logout=0A=0A=0AHow would i calcuate Employee and it Login dur= ation for period say from 2012-05-01 08:00:00 to 2012-05-01 22:00:00=0A=0A= =0A--Anupam=0A ---1439325297-1543822159-1340185139=:87173--