To date, my understanding is that mysql do not support sub-query.

My suggestion will be by using 2 sql statement.

The first statement will select value from the reference table. 
The value retrieve from first statement can be used to construct the second
statement.

Your first sql will be like :
a) Select a_col, b_col from table_a

Your second sql will be like 
b) select * from table_b where table_b.fk_col in ( value_a_col1,
value_a_col2, value_a_col3,...)

hope above help.



-----Original Message-----
From: Ligaya Turmelle [mailto:[EMAIL PROTECTED] 
Sent: 24 March 2004 09:25
To: [EMAIL PROTECTED]
Subject: Re: Strings and variables in select statements

I'm a beginner so don't quote me.  I beleive you need something like:

Select hs_identifiers.hs_id_num from hs_identifiers,
where (accession_num LIKE (result of another select statement)%);

I beleive that should give you the first part and if there is anything after
it.

Respectfully,
Ligaya Turmelle



"Annie Law" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I would appreciate help with the following.
> I have a table where each of the values in a column consists of a
> combination of letters and numbers followed by a decimal then a single
digit.
> Examples of the two types of entries that could be found in this
column(accession_num)
> are:
> BQ877252.1
> AA3588976.2
> and possibly
> T84780
> The entries above are found in a table called hs_identifiers.
> The hs_identifiers table has two columns accession_num and hs_id_num.
>
> Given an accession_num I want to be able to look up in the hs_identifiers
table to look up for the corresponding hs_id_num.
>
> This would be a simple select statement for example
> Select hs_identifiers.hs_id_num from hs_identifiers,
> where (accession_num = (result of another select statement)._)
> or (accession_num=(result of another select statement));
>
> The only thing is I am not sure what the syntax is for
> the part (accession_num = (result of another select statement)._)
>
> In the section (result of another select statement)._)  I am trying to
> say the result concatenated with a period concatenated with one wild card
character.
> For example: result of another select statement = BQ877252
> period is '.'
> and wild card character 1,2,3, etc.
> The whole string concatenated together would be BQ877252.1
>
> thanks,
> Annie.
>
>
>
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to