SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Please help repated row
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gokturk413
Starting Member

Azerbaijan
1 Posts

Posted - 02/05/2014 :  03:21:57  Show Profile  Reply with Quote
enter-------------------intvalue-----out----------------intvalue
2014-02-05 08:56:51.237 1 2014-02-05 08:57:05.997 2
2014-02-05 08:56:49.320 1 2014-02-05 08:57:03.490 2
2014-02-05 08:56:45.097 1 2014-02-05 08:56:57.840 2
2014-02-05 08:56:42.640 1 2014-02-05 08:56:55.727 2
2014-02-05 08:56:42.640 1 2014-02-05 11:37:46.493 2
2014-02-05 09:19:18.167 1 2014-02-05 08:56:55.727 2
2014-02-05 09:19:18.167 1 2014-02-05 11:37:46.493 2
2014-02-05 08:56:47.163 1 2014-02-05 08:57:00.737 2

please help when intvalue value change between 1-2 new row inserted
and out time or enter time repeated with above time
i need when changed intvalue enter or out time must be null
here is my query

SELECT yuyi.[timestamp] enter,yuyi.[intvalue],yuyi.[carrierid],yuyi.[lastname],azx.[timestamp] out,azx.[intvalue],azx.[carrierid],azx.[lastname]
FROM [aeosdb].[dbo].[view_eventlog_online] as yuyi join dbo.view_eventlog_online as azx on
yuyi.carrierid=azx.carrierid where azx.eventtype=5 and yuyi.eventtype=5 and yuyi.intvalue=1 and azx.intvalue=2
and(azx.timestamp>=CAST( GETDATE()as date)) and (yuyi.timestamp>=CAST( GETDATE()as date)) order by azx.carrierid,yuyi.carrierid

Edited by - gokturk413 on 02/05/2014 03:29:26

madhivanan
Premature Yak Congratulator

India
22761 Posts

Posted - 02/22/2014 :  11:58:18  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Can you post the expected output?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000