Ask a Question related to Dreamweaver AppDev, Design and Development.
-
mduke #1
Re: PHP/MySQL Left Join Question
CM: Finally getting back to this and maybe being in the middle of a bad flu
ain't helping, but I'm not getting the names to print and am wondering whether
I'm not using the right nomenclature in the table. My select statement (w/only
slight variation to yours) is:
$query_datetest = "SELECT DATE_FORMAT(alumni.last_modified, '%m/%d/%Y') as
lastDate, alumni.alumni_id, alumni.firstName, alumni.nickName, ...,
t1.lastName, t2.lastName, t3.lastName, t4.lastName FROM alumni LEFT OUTER JOIN
thesis_committee t1 ON alumni.committeeChair = t1.committee_id LEFT OUTER JOIN
thesis_committee t2 ON alumni.committee2 = t2.committee_id LEFT OUTER JOIN
thesis_committee t3 ON alumni.committee3 = t3.committee_id LEFT OUTER JOIN
thesis_committee t4 ON alumni.committee4 = t4.committee_id ORDER BY
alumni.lastName";
But I'm assuming that I need to modify how I invoke the printout from what I
have below:
<td><p><?php echo $row_datetest['thesisComm']; ?></p></td>
<td><p><?php echo $row_datetest['committee2']; ?></p></td>
<td><p><?php echo $row_datetest['committee3']; ?></p></td>
<td><p><?php echo $row_datetest['committee4']; ?></p></td>
No? I tried naming the <td> fields t1.lastName, etc., and as you likely would
know, that didn't work. I'm hoping there's an obvious oversight. Thanks for any
help you can provide.
mduke Guest
-
Is left-join faster then inner join?
Some people said that using left-join is generally faster than inner join, is that true? Thanks... -
Left join isn't joining
Hello, I've got a select statement that joins two tables. -- tblPageHitCalendar contains a single column holding dates. It has every day since... -
Left join, grouped output question
Hey All, I have a SQL JOIN / Output question. So for this simple CMS I have built I two tables I am joinging. An "issues" table (as in magazine... -
MySQL Left Join Question
This may not be the best place to ask this question, but I'm running into a problem when I perform a left join sql statement in PHP. The sql... -
left join problem
if you just need something unique in the result set, 1. combination (NJIDATA.GLPMSTR.ID, NJIDATA.GLPMTRN.ID) is unique 2. you could also use... -
CMBergin #2
Re: PHP/MySQL Left Join Question
You're almost there. You need to give each column with the same column name
an alias, as table names are no longer available when you've retrieved the
records.
SELECT ...snip..., t1.lastName AS Chairman, t2.lastName AS Member1,
t3.lastName AS Member2, t4.lastName AS Member3, ...snip...
Then, change your table to call the fields with those aliases:
<td><p><?php echo $row_datetest["Chairman"]; ?></p></td>
<td><p><?php echo $row_datetest["Member1"]; ?></p></td>
<td><p><?php echo $row_datetest["Member2"]; ?></p></td>
<td><p><?php echo $row_datetest["Member3"]; ?></p></td>
That's the final step. :)
"mduke" <webforumsuser@macromedia.com> wrote in message
news:cvo31u$ln0$1@forums.macromedia.com...flu> CM: Finally getting back to this and maybe being in the middle of a badwhether> ain't helping, but I'm not getting the names to print and am wondering(w/only> I'm not using the right nomenclature in the table. My select statementas> slight variation to yours) is:
>
> $query_datetest = "SELECT DATE_FORMAT(alumni.last_modified, '%m/%d/%Y')JOIN> lastDate, alumni.alumni_id, alumni.firstName, alumni.nickName, ...,
> t1.lastName, t2.lastName, t3.lastName, t4.lastName FROM alumni LEFT OUTERJOIN> thesis_committee t1 ON alumni.committeeChair = t1.committee_id LEFT OUTERwhat I> thesis_committee t2 ON alumni.committee2 = t2.committee_id LEFT OUTER JOIN
> thesis_committee t3 ON alumni.committee3 = t3.committee_id LEFT OUTER JOIN
> thesis_committee t4 ON alumni.committee4 = t4.committee_id ORDER BY
> alumni.lastName";
>
> But I'm assuming that I need to modify how I invoke the printout fromwould> have below:
>
> <td><p><?php echo $row_datetest['thesisComm']; ?></p></td>
> <td><p><?php echo $row_datetest['committee2']; ?></p></td>
> <td><p><?php echo $row_datetest['committee3']; ?></p></td>
> <td><p><?php echo $row_datetest['committee4']; ?></p></td>
>
> No? I tried naming the <td> fields t1.lastName, etc., and as you likelyfor any> know, that didn't work. I'm hoping there's an obvious oversight. Thanks> help you can provide.
>
CMBergin Guest
-
mduke #3
Re: PHP/MySQL Left Join Question
Hallelujah, that worked! Well, at least I was somewhat on the right track in
assuming I had to invoke the table output differently--just left out the other
"shoe" to that, obviously.
Thanks very much for your patience and assistance. Now I can leave work early
and try to recuperate from this rotten flu!
mduke Guest
-
CMBergin #4
Re: PHP/MySQL Left Join Question
No problem. :)
Hope you feel better.
"mduke" <webforumsuser@macromedia.com> wrote in message
news:cvo7s8$s5n$1@forums.macromedia.com...in> Hallelujah, that worked! Well, at least I was somewhat on the right trackother> assuming I had to invoke the table output differently--just left out theearly> "shoe" to that, obviously.
>
> Thanks very much for your patience and assistance. Now I can leave work> and try to recuperate from this rotten flu!
>
CMBergin Guest



Reply With Quote

