Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 delete and select at the same query

Author  Topic 

baktha.thalapathy
Starting Member

7 Posts

Posted - 2010-06-10 : 02:09:07
[code]
select SQL_CALC_FOUND_ROWS navl.xydata.Lat,
navl.xydata.Longi,
MIN(navl.xydata.GpsTime) as mn,
MAX(navl.xydata.GpsTime) as mx,
timediff(MAX(navl.xydata.GpsTime) ,MIN(navl.xydata.GpsTime) ) as idle,
navl.xydata.GpsTime
from navl.xydata
where navl.xydata.ObjectId='18'
and navl.xydata.ClientId='1'
and navl.xydata.GpsTime > '2010-06-08 00:00:00'
and navl.xydata.GpsTime < '2010-06-08 23:59:59'
AND navl.xydata.Speed = '0'
group by navl.xydata.Lat
order by navl.xydata.GpsTime asc

[/code]

from the above query i want to delete where mn=mx or idle='00:00:00'
please help me anybody having idea

thanks in advance

Bakthavachalam E

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-06-10 : 02:14:02
As per DB Architecture SQL are classified as DDL,DML,DCL

We can't able to combine these three in a single Statement.

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-10 : 02:38:22
SQL_CALC_FOUND_ROWS is MySQL.
This is a MS SQL Server forum.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -