Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert command into sql query
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01281878
Message ID:
01281907
Views:
6
>how it will be done in sql
>
>sele student
>     Set Filter To scode=zscode and lcode=zlcode and sec=zsec and admtd=1
>     Set Order To CODE
>     Goto Top
>     Do While !Eof()
>         zcode = code
>         zname = descr
>         zroll = roll
>         zweight = weight
>        zpath=path
>                 sele examtran
>         Goto Top
>         Seek zcode
>         If !Found()
>             Append Blank
>         Endif
>         If Found()
>             Locate For code=zcode
>         ENDIF
>
>         sele examtran
>
>         Replace sub25 With "Total"
>         Replace tmax With max01+max02+max03+max04+max05+max07+max08+max09+max10+max11+max12+max14+max15+max16+max18+max19+max20+max21+max22+max23+max24
>         Replace tmin With min01+min02+min03+min04+min05+min07+min08+min09+min10+min11+min12+min14+min15+min16+min18+min19+min20+min21+min22+min23+min24
>       .......
>         sele student
>         Skip
>     Enddo
> ENDIF
select * from student where scode=zscode and lcode=zlcode and sec=zsec and admtd=1
into cursor curToProcess nofilter
select * from curToProcess left join ExamTran ex on ... where ex.code is NULL into cursor curToInsert nofilter

insert into ExamTran (code) select code from curToInsert
update examtran 
set (all your changes)
from curToProcess inner join ExamTran on curToProcess.code = ExamTran.code
From the top of my head and not tested.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform