If the structure is always the same (i.e 3 different field values) then this will work, if not then its going to get messy and whoever designed the database structure could probably have done it a better way.

SELECT a.clientID, a.[value] AS one, b.[value] AS two, c.[value] AS three
FROM test a INNER JOIN
test b ON a.clientID = b.clientID INNER JOIN
test c ON c.clientID = a.clientID AND c.clientID = b.clientID
WHERE (a.fieldValue = 1) AND (b.fieldValue = 2) AND (c.fieldValue = 3)


Jason.


Ben Smith wrote:
I would say it can be done, yes, but you will need to do some serious
fiddling. Hopefully mySQL lets you do most of this on the db server.
I'd be creating a couple of views then querying against them in a
stored procedure.

On Fri, 20 Aug 2004 13:50:27 +1000, Gareth Edwards
<[EMAIL PROTECTED]> wrote:

Is the data from the query going to be always structured so neatly?

ie. will "fieldValue" always start at 1?

You could loop through the query and convert it to an Array of Structures or something?

Gareth.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Steve
Onnis
Sent: Friday, 20 August 2004 1:51 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Simplified recordset.

Have fun

your going to have to do some nice grouping with your query and play around
with the output

it can be done, just a little mucking about

Steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ricardo
Russon
Sent: Friday, August 20, 2004 1:32 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Simplified recordset.

MySQL. 4.1.1a

Steve Onnis wrote:


what database system you using?

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ricardo
Russon
Sent: Friday, August 20, 2004 1:10 PM
To: CFAussie Mailing List
Subject: [cfaussie] Simplified recordset.


excuse me while i think out in open space, But if any one has any ideas, please throw them back at me.

The table is structured in a fairly complex way. and it has to be this

way.

It relates to 2 other tables for different reasons.

So the complex table that i need to simplify on output is something like..

id    clientID        fieldValue         value
1     1                 1                     firstName1
2     1                 2                     middleName1
3     1                 3                     lastName1
4     2                 1                     firstName2
5     2                 2                     middleName2
6     2                 3                     lastName2
7     3                 1                     firstName3

and so on...
there are other values stored in that table, but i don't need them for

this.

What i want to get out of it is something like.

clientID      1                  2                       3
1               firstName1    middleName1     lastName1
2               firstName2    middleName2     lastName2
3               firstName3    middleName3     lastName3

I guess what i am really trying to figure out is if i can do this against
the database, or if i have to recreate the table on the cf.

There is another step which i left out, that the column names (1,2,3...)
actually get their values from another table. But that opens up so many
more problems...

baby steps.

TIA
Ricardo.

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/





--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]


To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/





--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to