Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting Sql Query to FoxPro
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Converting Sql Query to FoxPro
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01247365
Message ID:
01247365
Views:
64
Having trouble converting this sql code to FoxCode. Sections 1, 2, 3 I am fine with. It's when I get to section 4 that the trouble comes into play. I get 'Command contains unrecognized phrase/keyword' and it highlights
sum(isnull(num, 0)) as Num
into hidesedan
from (select T1.*, T2.Num
from (select Halfhour
from @HalfHours_S) as T1

from the query.

Any help would be great.


Section 1:
SELECT r.*, v.vehicletypeid
into routelfa
from routearchive r join vehicle v on r.vehicleid = v.id

Section 2:
select *
into sedanroutelfa
from routelfa where vehicletypeid = '400'

Section 3:
declare @HalfHours_S table (HalfHour int)
declare @intCounter_S int set @intCounter_s = 0
while @intCounter_s < 66

Section 4:
begin insert into @HalfHours_S
select @intCounter_S as HalfHour
SET @intCounter_S = @intCounter_S + 1
end declare @Shifts_S table (ShiftSt int, ShiftEnd int)
insert into @Shifts_S
select (cast(left(shiftstarttime,2) as int) * 60 + cast(right(shiftstarttime,2) as int))/30 as ShiftSt,
(cast(left(shiftendtime,2) as int) * 60 + cast(right(shiftendtime,2) as int))/30 as ShiftEnd
from sedanroutelfa
where tripdate = '5/22/2007' and (status is null or status <> 'deleted')
select right('0' + cast(HalfHour*30/60 as varchar), 2) + ':' + right('0' + cast(HalfHour*30 % 60 as varchar),2) + '-' + right('0' + cast((HalfHour*30+30)/60 as varchar), 2) + ':' + right('0' + cast((HalfHour*30+30) % 60 as varchar),2) as TimeSliceSedan,
sum(isnull(num, 0)) as Num
into hidesedan
from (select T1.*, T2.Num
from (select Halfhour
from @HalfHours_S) as T1
left join (select 1 as Num, ShiftSt, ShiftEnd
from @shifts_S) as T2 on T1.Halfhour >= T2.ShiftSt and T1.HalfHour < T2.ShiftEnd) results
group by HalfHour
Jules
Next
Reply
Map
View

Click here to load this message in the networking platform