portal
07-19-2006, 04:42 AM
$query = mysql_query("SELECT
doors.oid AS doid,
windows.oid AS oid,
doors.height AS dheight,
windows.height AS height,
doors.width AS dwidth,
windows.width AS width,
doors.price AS dprice,
windows.price AS price,
windows.ocid AS ocid,
windows.grills AS grills,
windows.iid AS iid,
windows.lid AS lid,
windows.sid AS sid,
doors.doortype AS doortype,
doors.doorstyle AS doorstyle,
doors.category AS category,
doors.doormat AS doormat,
doors.concol AS concol,
doors.success AS dsuccess,
doors.type AS type,
doors.uid AS duid
FROM doors, windows WHERE
windows.success='0' AND doors.success='0'
AND windows.uid='$uid' AND doors.uid='$uid' ORDER BY windows.sid ASC, windows.oid ASC, doors.oid $max");
This throws a cartisian pattern in the result, meaning that if I have 3 entries in table "windows" and 1 entry in table "doors" the results will show:
Window 1
Door 1
Window 2
Door 1
Window 3
Door 1
What I need this query to accomplish is the following:
Window1
Window 2
Window 3
Door 1
meaning that I only need it to show each entry only once, instead of repeating that entry multiple times.
This is complex, hopefully somebody can help me.
doors.oid AS doid,
windows.oid AS oid,
doors.height AS dheight,
windows.height AS height,
doors.width AS dwidth,
windows.width AS width,
doors.price AS dprice,
windows.price AS price,
windows.ocid AS ocid,
windows.grills AS grills,
windows.iid AS iid,
windows.lid AS lid,
windows.sid AS sid,
doors.doortype AS doortype,
doors.doorstyle AS doorstyle,
doors.category AS category,
doors.doormat AS doormat,
doors.concol AS concol,
doors.success AS dsuccess,
doors.type AS type,
doors.uid AS duid
FROM doors, windows WHERE
windows.success='0' AND doors.success='0'
AND windows.uid='$uid' AND doors.uid='$uid' ORDER BY windows.sid ASC, windows.oid ASC, doors.oid $max");
This throws a cartisian pattern in the result, meaning that if I have 3 entries in table "windows" and 1 entry in table "doors" the results will show:
Window 1
Door 1
Window 2
Door 1
Window 3
Door 1
What I need this query to accomplish is the following:
Window1
Window 2
Window 3
Door 1
meaning that I only need it to show each entry only once, instead of repeating that entry multiple times.
This is complex, hopefully somebody can help me.
