|
-
March 11th, 2009, 10:44 PM
#1
Help w/ this query!
im using phpmyadmin
first of all i have this tables,
table TROUBLE_REPORTED w/ fields CODE, TR_ID
table FINDINGS w/ fields CODE, FINDINGS_ID
table SERVICE_PERFORMED w/ fields CODE, SVC_PER_ID
table SO_TROUBLE_REPORTED w/ fields SO_TR_ID, TR_ID, SO_NO
table SO_FINDINGS w/ fields SO_FINDINGS_ID, FINDINGS_ID, SO_NO
table SO_SERVICE_PERFORMED w/ fields SO_SP_ID, SVC_PER_ID, SO_NO
table SERVICE_ORDER w/ many fields including SO_NO as primary key
now,
in a SERVICE ORDER there is a SELECT STATEMENTS where u can add a possible of 4 TROUBLE REPORTED, 4 FINDINGS and 4 SERVICE PERFORMED. Those SELECT STATEMENTS have value of CODE coming form tables TROUBLE_REPORTED, FINDINGS and SERVICE PERFORMED. Now when u insert the SERVICE ORDER those reports will be inserted in SO_TROUBLE_REPORTED, SO_FINDINGS and SO_SERVICE_PERFORMED with its their foreign key TR_ID, FINDINGS_ID, SVC_PER_ID respectively having similar SO_NO.
then what i want now is to retrieve those data coming from SO_TROUBLE_REPORTED, SO_FINDINGS and SO_SERVICE_PERFORMED,
i have this query and its a MESS
PHP Code:
<? $children = mysql_query("SELECT UCASE(service_performed.code) as service_performed, UCASE(trouble_reported.code) as trouble_reported, UCASE(findings.code) as find FROM so_trouble_reported inner join so_service_performed ON so_service_performed.so_no = so_trouble_reported.so_no inner join so_findings ON so_trouble_reported.so_no = so_findings.so_no left join trouble_reported ON trouble_reported.tr_id = so_trouble_reported.tr_id left Join findings ON findings.findings_id = so_findings.findings_id left Join service_performed ON service_performed.svc_per_id = so_service_performed.svc_per_id WHERE so_trouble_reported.so_no = $so_no") or die (mysql_error()); while($row2=mysql_fetch_array($children)) { $tr = $row2["trouble_reported"]; $findings = $row2["find"]; $sp = $row2["service_performed"]; ?>
it displays repeated values
hope this problem is clear w/ u guys.
need help
Last edited by ryanbong; March 13th, 2009 at 12:08 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|