Forum Moderators: open

Message Too Old, No Replies

some query help please....

tricky logic

         

txbakers

11:11 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



in mySQL

The table has 9 fields : id,1,2,3,4,5,6,7,8

For X ids, I need to bring up a distinct list of data from the other 8 fields.

For example:
id 1 2 3
777 abc def ghi
888 xyz abc def

should only return :
abc,def,ghi,xyz

I tried using "distinct" but that didn't work, because line 1 and line 2 are distinct indeed.

Is there a simple way to do this other than lots of nested selects with!=?

Thanks.

txbakers

11:16 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See, that's why I post these connundrums. The simple act of writing in English, explaining it to the world, helps me understand the problem better.

I found the solution not in a query, but in building my display array after the query:

if (String(rsStudents("p1te"))!= "null") {
if (String(taddresses).indexOf(rsStudents("p1te")) == -1) {
addresses += rsStudents("p1te") + sep;
taddresses += rsStudents("p1te") + "<br>";
tnames += rsStudents("p1t") + "<br>"
}
}