473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

basic SQL question

Dear all,

I have the following problem,

I am trying to select records from two tables.

the tables are constructed like:
block
block_id
sequence_id
snp_required
first_polymorphism_index
last_polymorphism_index
first_reference_positio
last_reference_position
start_pos
end_pos
tiled_bp

polymorphism_block_map
block_id
polymorphism_index
polymorphism_id

When I try to do:

mysql> select first_polymorphism_index,last_polymorphism_index from
block where first_polymorphism_index like "14163" OR
first_polymorphism_index like "14750" OR first_polymorphism_index
like "14932";
+--------------------------+-------------------------+
| first_polymorphism_index | last_polymorphism_index |
+--------------------------+-------------------------+
| 14163 | 14235 |
| 14750 | 14802 |
| 14932 | 14980 |
+--------------------------+-------------------------+
3 rows in set (0.02 sec)

everything works fine, easy ;)

but if I try to link these two tables I got:
+--------------------------+--------------------+-----------------+-----
--------------------+--------------------+-----------------+
| first_polymorphism_index | polymorphism_index | polymorphism_id |
last_polymorphism_index | polymorphism_index | polymorphism_id |
+--------------------------+--------------------+-----------------+-----
--------------------+--------------------+-----------------+
| 14163 | 14163 | P0216196
| 14235 | 14235 | P0216288 |
| 14750 | 14750 | P0217007
| 14235 | 14235 | P0216288 |
| 14932 | 14932 | P0217251
| 14235 | 14235 | P0216288 |
+--------------------------+--------------------+-----------------+-----
--------------------+--------------------+-----------------+
3 rows in set (1 min 27.48 sec)

##
# this does not return the right values on the las polymorphism index
##

SELECT
b1.first_polymorphism_index,
p1.polymorphism_index,
p1.polymorphism_id,
b2.last_polymorphism_index,
p2.polymorphism_index,
p2.polymorphism_id
FROM
block as b1,
polymorphism_block_map as p1,
block as b2,
polymorphism_block_map as p2
WHERE
b1.first_polymorphism_index = p1.polymorphism_index
AND
b2.last_polymorphism_index = p2.polymorphism_index
LIMIT 5;
But the second polymorphism_index is always the same,

How I can get the right one?

Thanks in advance

P
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1002

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: pauldepstein | last post by:
I am reading Grimshaw and Ortega's "C++ and Numerical Methods." They construct a vector class which contains the variable vec, a float* variable where the length of the array (number of...
6
by: DH | last post by:
I have a VERY basic question about figuring database size. I've inherited a database which is generally similar to this basic one: Item, Red, Blue, Green, Yellow (text), (int),(int),(int),(int)...
9
by: Malcolm | last post by:
After some days' hard work I am now the proud possessor of an ANSI C BASIC interpreter. The question is, how is it most useful? At the moment I have a function int basic(const char *script,...
4
by: Ramesh | last post by:
hi, Let me ask some basic questions. Can anybody explain me about the following questions: 1. When we have to create sn key? Whenever we compiled Component we have to create or it is a one time...
13
by: Pete | last post by:
I'm cross posting from mscom.webservices.general as I have received no answer there: There has been a number of recent posts requesting how to satisfactorily enable BASIC authorization at the...
5
by: Aussie Rules | last post by:
Hi, Having a mental block on this one. Have done it before but can't rack my brain on how... I have an object, with a bunch on property, and I add that object to a combo box. I want the...
4
by: MikeB | last post by:
I've been all over the net with this question, I hope I've finally found a group where I can ask about Visual Basic 2005. I'm at uni and we're working with Visual Basic 2005. I have some books, ...
1
by: frankhanretty | last post by:
Do I have to install Visual basic on the remote terminals as I did on the server? I have an visual basic 5 application running fine on my client's server and he is now networked. He wants to run the...
4
by: Chris Asaipillai | last post by:
Hi there My compay has a number of Visual Basic 6 applications which are front endeed onto either SQL Server or Microsoft Access databases. Now we are in process of planning to re-write these...
3
by: Scott Stark | last post by:
Hello, I'm trying to get a better handle on OOP programming principles in VB.NET. Forgive me if this question is sort of basic, but here's what I want to do. I have a collection of Employee...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.