Select changing variable
Posted by:
Jared Cox
Date: December 29, 2008 10:35AM
Using two tables, I need to fetch results from one, and using that information, fetch a set of results from the second. I am checking that the "style" is ok to run in the decided "mat_type" (Y or N)
Table_1
-----------------------------------
Position......Name.....Mat_type
...1............style1.....Mat_1
...2............style2.....Mat_2
-----------------------------------
Table_2
-----------------------------------
Name......Mat_1......Mat_2
style1........Y..........N
style2........Y..........N
-----------------------------------
As two separate queries, I would run
SELECT Mat_Type FROM Table_1 WHERE Position = '1'
SELECT **result from 1st query** FROM Table_2 WHERE Name = (SELECT Name FROM Table_1 WHERE Position ='1')
I need to run these as 1 query; anyone have a suggestion on how I can merge them? I have tried using user variables, but they have come up with errors. I am pretty new at mysql, so the more notes, the better.
Thanks
Jared
Subject
Views
Written By
Posted
Select changing variable
3608
December 29, 2008 10:35AM
1639
December 29, 2008 11:47AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.