Jump to content

Archived

This topic is now archived and is closed to further replies.

jag

help with data output

Recommended Posts

i\'m stuck on a data output problem. i\'m accessing a mysql database and retrieving all the row data. there are 3 fields - UID, SID, Answer

 

i\'m connecting and getting the data just fine. the problem is that there are multiple rows with the same UID and the data prints just like that. here\'s a sample:

 

83332091781424;2;felwick01

83332091781424;2;x

83332091781424;2;N1

83332091781424;2;N1

83332091781424;2;N1

83332091781424;2;N2

39808168103209171;2;felwick02

39808168103209171;2;x

39808168103209171;2;N2

39808168103209171;2;N1

39808168103209171;2;N4

39808168103209171;2;N6

 

 

what i need is only 1 instance of the UID, 1 instance of the SID, and then all the Answer field for each UID printed in a continuous row. example -

 

83332091781424;2;felwick01;x;N1;N1;N1;N2

39808168103209171;2;felwick02;x;N2;N1;N4;N6

 

any help would be *greatly* appreciated!

Share this post


Link to post
Share on other sites

Hi,

 

This can NOT be done in sql, since you want a variable number of rows returned and printed on one line.... It\'s a LOT easier to parse your output in php, and return what you want. (Or any other language, perl, basic, fortran whatever... )

 

On each new line>

while grab line {

 

if UID = UID above, nothing ELSE print UID

if SID = SID above, nothing ELSE print SID

print field3;

 

}

 

will do it, format to any language...

 

P.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.