| ¤W¤@½g¥DÃD :: ¤U¤@½g¥DÃD   | 
	
	
	
		| µoªí¤H | 
		¤º®e | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 1 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 12:01 pm    ¤å³¹¥DÃD: ½Ð°ÝVFP SQLÄæ¦ì¦X¨Ö¦r¦ê¬Û¥[ªº°ÝÃD | 
				     | 
			 
			
				
  | 
			 
			
				½Ð°Ý¦U¦ìVFP¥ý¶i¡AÃö©óVFP SQLÄæ¦ì¦X¨Ö¦r¦ê¬Û¥[ªº°ÝÃD
 
 
table A¡@¡@table b
 
¾Ç¸¹¡@¡@¡@¡@¾Ç¸¹¡B½Ò¦W 
 
a01¡@¡@¡@¡@a01¡@°ê¤å
 
a02¡@¡@¡@¡@a01¡@^¤å
 
a03¡@¡@¡@¡@a02¡@^¤å
 
¡@¡@¡@¡@¡@¡@a02¡@¾ú¥v  
 
¡@¡@¡@¡@¡@¡@a02¡@¦ÛµM 
 
¡@¡@¡@¡@¡@¡@a03¡@°ê¤å
 
¡@¡@¡@¡@¡@¡@a03¡@¦a²z
 
 
 
½Ð°ÝSQL»yªkn¦p¦ó¤U¡A½Ò¦WÄæ¦ìªº¦r¦ê¤~·|¬Û¥[?
 
Åܦ¨¦p¤Uµ²ªG
 
 
table A
 
¾Ç¸¹¡B½Ò¦W
 
a01¡@°ê¤å,^¤å
 
a02¡@^¤å,¾ú¥v,¦ÛµM 
 
a03¡@°ê¤å,¦a²z
 
 
·PÁÂ _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		CPS0204
 
 
  µù¥U®É¶¡: 2014-08-24 ¤å³¹: 482
 
  ²Ä 2 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 2:12 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				µo´§vfp cursor ªºªø³B
 
SELE TABLE_A
 
scan
 
 
   repl A.DUMY_NAME WITH .....
 
ENDSCAN | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 3 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 2:37 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | CPS0204 ¼g¨ì: | 	 		  µo´§vfp cursor ªºªø³B
 
SELE TABLE_A
 
scan
 
 
   repl A.DUMY_NAME WITH .....
 
ENDSCAN | 	  
 
 
·PÁ¦^ÂÐ
 
³o¤]¬O§Ú¥Ø«eªº°µªk.... ¦ýµ§¼Æ¤@¦hªº¸Ü¡Anªá¤ñ¸û¦h®É¶¡¡A©Ò¥H¤~·|·Q´M¨D¨ä¥L¤èªk _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 4 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 2:53 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				https://ithelp.ithome.com.tw/articles/10197780
 
 	  | ¥N½X: | 	 		  
 
select DISTINCT  name,
 
datelist=
 
(
 
   SELECT cast(rundate AS NVARCHAR ) + ',' 
 
    from #UEFO_Country     
 
   where name=t0.name   --§âname¤@¼Ëªº¥[°_¨Ó
 
   FOR XML PATH('')
 
)
 
from #UEFO_Country t0
 
 | 	  
 
 
³o¬Oª¦¤å§ä¨ìªº¤èªk¡A¦ýVFP¦ü¥G¨S¦³³o¼Ëªº»yªk.... ¤p§Ì¥Îªº¬OVFP6 _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		syntech
 
 
  µù¥U®É¶¡: 2003-05-16 ¤å³¹: 4252 ¨Ó¦Û: Taipei,Taiwan
  ²Ä 5 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 3:23 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				Âà¨ì excel ±Æ¤@±Æ«á§ì¦^¨Ó _________________ ¦pªG¤½¥q¦³¤U¦C§xÂZ:
 
1. §ä¤£¨ì«K©y,§Ö³t,²©öªº ¥Í²£±Æµ{³nÅé
 
2. ¤£ª¾¹D¦p¦ó§Ö³t±Æ©w ±ÄÁÊp¹º
 
3. ¦¨¥»§ì¤£·Ç,¦Û¤vºâ¤ñ³nÅéºâ¦³¥Î
 
4. ·Q¾Ç²ß¨t²Î³W¹º,·Q§ä¨t²Î¬[ºcªºÅU°Ý
 
 
½ÐÁpµ¸§ÚÌ,¤]³\§ÚÌÀ°±o¤W¦£ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		CPS0204
 
 
  µù¥U®É¶¡: 2014-08-24 ¤å³¹: 482
 
  ²Ä 6 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 4:21 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Bruce Lin ¼g¨ì: | 	 		   	  | CPS0204 ¼g¨ì: | 	 		  µo´§vfp cursor ªºªø³B
 
SELE TABLE_A
 
scan
 
 
   repl A.DUMY_NAME WITH .....
 
ENDSCAN | 	  
 
 
·PÁ¦^ÂÐ
 
³o¤]¬O§Ú¥Ø«eªº°µªk.... ¦ýµ§¼Æ¤@¦hªº¸Ü¡Anªá¤ñ¸û¦h®É¶¡¡A©Ò¥H¤~·|·Q´M¨D¨ä¥L¤èªk | 	  
 
 
table b ¦³¤Uindex
 
´X¦Ê¸Uµ§,¤]¬O«Ü§Öªº | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		yctsai
 
 
  µù¥U®É¶¡: 2003-04-11 ¤å³¹: 180
 
  ²Ä 7 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 10:27 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				¦pªGn¥Îsql »yªk,¥i¯àn¤À¦¸°õ¦æsql 
 
 
1. ¥ý§ä¥X½Ò¦W
 
   select ½Ò¦W from table b group by  ½Ò¦W  into cursor tmp
 
 
 
2   select tmp
 
     scan
 
        select ¾Ç¸¹ from b where ½Ò¦W=tmp.½Ò¦W into cursor tmp1
 
        
 
        ¥H¤U¨S·Q¦n
 
        update table a set ½Ò¦W=½Ò¦W+tmp.½Ò¦W where ....
 
        ©ÎªÌ
 
        select .. from table A join tmp1 into cursor ....
 
         
 
        
 
     endscan | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		lygcw9603
 
 
  µù¥U®É¶¡: 2011-12-25 ¤å³¹: 130
 
  ²Ä 8 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¥| ¤G¤ë 25, 2021 11:11 pm    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | ¥N½X: | 	 		  close databases
 
create cursor ta (¾Ç¸¹ c(5), ½Ò¦W c(100))
 
insert into ta (¾Ç¸¹) select distinct ¾Ç¸¹ from tb
 
index on ¾Ç¸¹ tag xh
 
 
select tb
 
set relation to ¾Ç¸¹ into ta
 
scan
 
    replace ½Ò¦W with alltrim(½Ò¦W) + "," + alltrim(tb.½Ò¦W) in ta
 
endscan
 
set realtion to
 
select ta
 
set order by
 
replace ½Ò¦W with substr(½Ò¦W, 2) all
 
browse | 	  
 
³t«×¤£¬O°ÝÃD¡A1wµ§°O¿ý¬í±þ¡C¸ÓÃþ°ÝÃD¸g¨å³B²z¤èªk¡C¦pªG¼Æ¾Ú¶q¤jªº¸Ü¡A³t«×µ´¹ï¤ñVFP¤¤ªºSQL©R¥O§Ö¡C | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 9 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¤ ¤G¤ë 26, 2021 11:20 am    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | syntech ¼g¨ì: | 	 		  | Âà¨ì excel ±Æ¤@±Æ«á§ì¦^¨Ó | 	  
 
¤]¬O¤@Ó¤èªk 
 
·PÁ¦^ÂÐ _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 10 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¤ ¤G¤ë 26, 2021 11:21 am    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | CPS0204 ¼g¨ì: | 	 		   	  | Bruce Lin ¼g¨ì: | 	 		   	  | CPS0204 ¼g¨ì: | 	 		  µo´§vfp cursor ªºªø³B
 
SELE TABLE_A
 
scan
 
 
   repl A.DUMY_NAME WITH .....
 
ENDSCAN | 	  
 
 
·PÁ¦^ÂÐ
 
³o¤]¬O§Ú¥Ø«eªº°µªk.... ¦ýµ§¼Æ¤@¦hªº¸Ü¡Anªá¤ñ¸û¦h®É¶¡¡A©Ò¥H¤~·|·Q´M¨D¨ä¥L¤èªk | 	  
 
 
table b ¦³¤Uindex
 
´X¦Ê¸Uµ§,¤]¬O«Ü§Öªº | 	  
 
½T¹ê¦p¦¹ _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 11 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¤ ¤G¤ë 26, 2021 11:23 am    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | yctsai ¼g¨ì: | 	 		  ¦pªGn¥Îsql »yªk,¥i¯àn¤À¦¸°õ¦æsql 
 
 
1. ¥ý§ä¥X½Ò¦W
 
   select ½Ò¦W from table b group by  ½Ò¦W  into cursor tmp
 
 
 
2   select tmp
 
     scan
 
        select ¾Ç¸¹ from b where ½Ò¦W=tmp.½Ò¦W into cursor tmp1
 
        
 
        ¥H¤U¨S·Q¦n
 
        update table a set ½Ò¦W=½Ò¦W+tmp.½Ò¦W where ....
 
        ©ÎªÌ
 
        select .. from table A join tmp1 into cursor ....
 
         
 
        
 
     endscan | 	  
 
·PÁ¦^ÂÐ _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		Bruce Lin
 
 
  µù¥U®É¶¡: 2004-03-28 ¤å³¹: 24 ¨Ó¦Û: Taiwan,Taipei
  ²Ä 12 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¤ ¤G¤ë 26, 2021 11:24 am    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | lygcw9603 ¼g¨ì: | 	 		   	  | ¥N½X: | 	 		  close databases
 
create cursor ta (¾Ç¸¹ c(5), ½Ò¦W c(100))
 
insert into ta (¾Ç¸¹) select distinct ¾Ç¸¹ from tb
 
index on ¾Ç¸¹ tag xh
 
 
select tb
 
set relation to ¾Ç¸¹ into ta
 
scan
 
    replace ½Ò¦W with alltrim(½Ò¦W) + "," + alltrim(tb.½Ò¦W) in ta
 
endscan
 
set realtion to
 
select ta
 
set order by
 
replace ½Ò¦W with substr(½Ò¦W, 2) all
 
browse | 	  
 
³t«×¤£¬O°ÝÃD¡A1wµ§°O¿ý¬í±þ¡C¸ÓÃþ°ÝÃD¸g¨å³B²z¤èªk¡C¦pªG¼Æ¾Ú¶q¤jªº¸Ü¡A³t«×µ´¹ï¤ñVFP¤¤ªºSQL©R¥O§Ö¡C | 	  
 
 
·PÁ¦^ÂÐ
 
ªGµM¬O¬í±þ°Ú!! °÷¸g¨å!! _________________ = BRUCE LIN =  ^_^ | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		DennisTsai
 
 
  µù¥U®É¶¡: 2005-07-26 ¤å³¹: 178
 
  ²Ä 13 ¼Ó
  | 
		
			
				 µoªí©ó: ¬P´Á¤é ¤G¤ë 28, 2021 5:51 am    ¤å³¹¥DÃD:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Bruce Lin ¼g¨ì: | 	 		  https://ithelp.ithome.com.tw/articles/10197780
 
 	  | ¥N½X: | 	 		  
 
select DISTINCT  name,
 
datelist=
 
(
 
   SELECT cast(rundate AS NVARCHAR ) + ',' 
 
    from #UEFO_Country     
 
   where name=t0.name   --§âname¤@¼Ëªº�[°_¨Ó
 
   FOR XML PATH('')
 
)
 
from #UEFO_Country t0
 
 | 	  
 
 
³o¬Oª¦¤å§ä¨ìªº¤èªk¡A¦ýVFP¦ü¥G¨S¦³³o¼Ëªº»yªk.... ¤p§Ì¥Îªº¬OVFP6 | 	  
 
 
³o¬O¥¿¸Ñ!³t«×¸§Ö | 
			 
		  | 
	
	
		| ¦^³»ºÝ | 
		 | 
	
	
		  | 
	
	
		 |