2012-03-03 2 views
0

나는 미터기가 같지 않지만 2 개의 테이블에서 데이터를 얻을 수있는 방법을 알고 싶다. 그러나 새로운 읽기 후에 변경된 데이터는 새로운 읽기 후에 폼에 표시된다. I 데이터는 billno 미터없는 결과 accoding의 요구 이들 2 개 테이블에서주어진 계량기에 대해 두 테이블 (청구서 및 고객)의 결제 정보를 얻으려면 어떻게해야합니까?

판독 테이블이 명세서에있어서로부터 생성되는

...

**table name is:bills:** 
billno, 
meterno, 
previousreading, 
currentreading, 
amount 

**second table is customer:** 
custid , 
meterno, 
fathername, 
unitrate, 
reading, 
connectiontype 

의 형식은

meterno, 
billno, 
cusstid, 
connectiontype, 
previousreading, 
currentreading, 
name, 
amount 

답변

2

다음은 찾고있는 데이터입니다.

select b.meterno, b.billno, c.custid, c.connectiontype, b.previousreading, b.currentreading, c.fathername, b.amount 
from bills b 
    inner join customer c on c.meterno = b.meterno 
관련 문제