Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL and COUNT?
Message
 
To
26/10/2005 11:03:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01062221
Message ID:
01062296
Views:
14
SELECT c.jobno,a.drwno,c.lastrev,a.revno,b.date AS trdate,a.transno, .f. AS FirstDrwNo;
       FROM issuehistory a ;
       LEFT JOIN transmittallog b ON a.transno = b.transno ;
       LEFT JOIN drawinglog     c ON ALLTRIM(a.drwno)==ALLTRIM(c.drwno) ;
       WHERE !DELETED() AND (ALLTRIM(b.iscode)=='A' OR ALLTRIM(b.iscode)=='B') ;
       ORDER BY c.jobno,sort1,sort2,sort3;
INTO CURSOR curPrint READWRITE


m.lcSelectDrwNo = "alskfh" && Some string that you are sure can't be presented in DrwNo field
SCAN
   REPLACE FirstDrwNo WITH NOT DrwNo == m.lcSelectDrwNo
   m.lcSelectDrwNo = DrwNo 
ENDSCAN
>I have the following SQL statement:
>
>
>SELECT c.jobno,a.drwno,c.lastrev,a.revno,b.date AS trdate,a.transno ;
>FROM issuehistory a ;
>	LEFT JOIN transmittallog b ;
>		ON a.transno = b.transno ;
>	LEFT JOIN drawinglog c ;	
>		ON ALLTRIM(a.drwno)==ALLTRIM(c.drwno) ;
>INTO CURSOR curPrint ;
>WHERE !DELETED() AND (ALLTRIM(b.iscode)=='A' OR ALLTRIM(b.iscode)=='B') ;
>ORDER BY c.jobno,sort1,sort2,sort3
>
>
>
>
>This returns the following:
>
>
>Jobno      Drwno     Lastrev     Revno    Trdate     Transno
>6037       E101A        C         0     01/17/2003    58995
>6037       E101A        C         0     01/24/2003    59159
>6037       E101A        C         A     02/10/2003    59352
>6037         1          B         0     01/17/2003    58995
>6037         1          B         A     01/24/2003    59159
>...
>
>
>Is there a way to tag the first instance of a drawing number? Something like below:
>
>
>Jobno      Drwno     Lastrev     Revno    Trdate     Transno   First
>6037       E101A        C         0     01/17/2003    58995      .T.
>6037       E101A        C         0     01/24/2003    59159      .F.
>6037       E101A        C         A     02/10/2003    59352      .F.
>6037         1          B         0     01/17/2003    58995      .T.
>6037         1          B         A     01/24/2003    59159      .F.
>...
>
>
>Any help would be greatly appreciated.
>
>Thanks in advance.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform