If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Use a SELECT statement for multiple fields on 1 field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-30-11, 10:57
Fimlore Fimlore is offline
Registered User
 
Join Date: Apr 2011
Posts: 1
Use a SELECT statement for multiple fields on 1 field

Hello there,

sorry about the Title of this post... I can't really figure out how to name this ^^

I'm struggeling with a query that I need to write that does the following:

I have 2 tables:

tblRun
=======================================
TOPIC_ID | RUN_ID | MAIN_CHAR_ID | ALT_CHAR_ID
=======================================
and

tblChar
==========================
char_id | char_name | char_class
==========================

The values in tblRun should be:
=======================================
TOPIC_ID | RUN_ID | MAIN_CHAR_ID | ALT_CHAR_ID
=======================================
123|1|99|555?44?333|

where Alt char ID is separated by the questionmark (these are multiple values)

and in the tblChar there sould be:
==========================
char_ID | char_name | char_class
==========================
99 | Fimlore | 2 |
333 | FimsAlt | 3
555 | FimsOtherAlt | 1

Now, I need a query in which I can add a name to the MAIN_CHAR_ID, as well as to >> all << the ALT_CHAR_ID's
thus, generating something like:

123 | 1 | 99 | Fimlore | 2
123 | 1 | 333 | FimsAlt | 3
123 | 1 | 555 | FimsOtherAlt | 1

is there any way to do this? or should I run a Query for each ? in the ALT_CHAR_ID field?

thanks in advance,

Fimlore
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On