| Order and Match Do not envision "how to" |
henry0

msg:4279691 | 4:32 pm on Mar 10, 2011 (gmt 0) | I cannot come with a concept Case: Table with many rows, among fields are A, B, C, each are int and contain a value from 1 to 5 example id 333 when ordered by int value comes with a result aqual at B, C, A and here is my quandary how could I match/select all rows where the same result B, C, A as id 333 exists? I mean doing it in a consise way and not resource "gobling". thanks
|
henry0

msg:4279807 | 6:46 pm on Mar 10, 2011 (gmt 0) | This an "ugly" and not clever nested query so how avoiding it? $result = $db->query(" select a, b, c, username from my_table where id='333' "); while ($row=$db->fetch_array($result) ) { $u_name=$row['username']; $a=$row['a']; $b=$row['b']; $c=$row['c']; $result2 = $db->query(" select a, b, c, username from my_table where username !='$u_name' AND a ='$a' AND b='$b' AND c='$c' "); while ($row=$db->fetch_array($result2) ) { $username=$row['username']; echo"UN: $username"; } } <edit>Typo</edit>
|
henry0

msg:4280181 | 1:38 pm on Mar 11, 2011 (gmt 0) | Mods: Since no one had a shot at it please, move this thread to PHP forum Perhaps, I should have been there instead of DB forum thanks
|
|
|