[SQL] return two rows from one

Geffy

OSNN Veteran Addict
Joined
18 Mar 2002
Messages
7,805
I have a slight problem. I am wanting to optimise a set of tables which seem to have been modelled on text based config files (not the wisest idea) for a server application I have to manage.

The table format I want to use is distributed over a couple of different tables which I can link together without much trouble.

The trouble is that the server application wants the data back like this for a specific username:
id, username, attribute, value, op
10, chickens@tempuri.org, Framed-IP-Address, 192.168.1.138, :=
11, chickens@tempuri.org, cisco-avpair, ip:route=192.168.1.1, :=

The lookup is based on the username for the existing database format.

So how can I somehow maybe join up two queries to return two distinct rows of data?

edit: this has to work with MySQL 4.1 btw ;)
 
Last edited:
if you said WHERE username = wuldn't that return two rows?
 
you can't return two rows of data with one query unless the data is on two rows in the database as far as I'm aware.
 
you can't return two rows of data with one query unless the data is on two rows in the database as far as I'm aware.
bugger then, this is what I am needing to do. Will have to investigate if I can stick something in between the database and the application to fetch the data and convert it into what it needs.

@Khayman: I think I need an anti-Union, one query split into two result rows
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back