Help in formulating sql query

Posted by AJ on Stack Overflow See other posts from Stack Overflow or by AJ
Published on 2010-05-16T16:34:48Z Indexed on 2010/05/16 16:40 UTC
Read the original article Hit count: 201

Filed under:

Here is my scenario

Table 1: GID || Info1

Table 2: GID || Tb1GID (refers to GID of Table1) || Info2

Table 3: GID || Info3

Table 4: GID || Tb2GID (refers to GID of Table2 || Tb3GID (refers to Table3 GID || Value

Now I have to build an sql query to get the value, given a particular Info1, Info2, Info3. Essentially, I have to get the GID, of table 1 using info1, GID of table to , by mapping info2 and GID of table 1. And then get the GID of table 3 using info 3. And combine these to GIDs to get the value in table 4.

What is the most optimal way of constructing an sql query for this one?

© Stack Overflow or respective owner

Related posts about sql