Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrive data from Sql table based on resulted Cursor
Message
 
 
To
22/11/2005 07:47:33
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01071100
Message ID:
01071125
Views:
21
Make the first select into derived table and use it in the second one.
Also it's bad idea to use one letter meaningless table aliases because it makes you selects unreadable and hard to maintain.


>>
>*****>First, trying to retrive all datas from JobMaster(JobMast) file with specified
>conditions into cursor temp.
>*****>Then, trying to sum total Qty and Total Amount from the Transactin file (SoTrs) based on
>*****>Qurey result.
>*********************************************
>and Vfp code here
>
>if ThisForm.chk3mth.value=1
> mcond2='month(date())-month(job_salorddt)>3'
>else
> mcond2='!empty(job_salorddt)'
>endif
>
>SalExpDat - Expire date
>SalExpPrd - Expire Period(No.of months)
>
>Sele SalOrdDt As sodate, IIF(SalExpDat)>Date(),Gomonth(SalExpDat,SalExpPrd),SalExpDat) As ExpireDate,SalOrdno as sovno, CusCode as cusno, ;
>IIF(empty(CusCode),JobCustomer,Customer.Cusname) as cusname,;
>Code as jobcode, discount as discamt From jobmast where branch_code= cBranch ;
>and !empty(Salordno) and Jobclose#'C' and jobapproval='A' and &mcond2 into cursor temp
>
>Sele a.so_docno as sovno, ;
>a.so_qty as qty, a.so_price as rate, a.so_discper as disc, a.so_date, sum((a.so_qty-a.so_bkdqty)*a.so_price) as totprice, ;
>sum((a.so_qty-a.so_bkdqty)*a.so_cost) as totcost, b.sodate, b.cusname, b.ref, b.jobcode, b.sman, b.appdt, b.discamt, ;
>iif(ttod(a.so_date)>ttod(b.appdt),"N"," ") as newitm ;
>from sotrs a, temp b where a.so_docno=b.sovno ;
>and a.so_delflag and a.so_qty-a.so_boqty#0 into cursor tempcur group by a.so_docno
>
>Sele tempcur
>brow
>
>I want to just convert it into Sql Server Code.
>
>With thanks and regards
>Abdulla
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform