How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ATLPROG Your Own Question

ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7677
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

I am in need of a recursive SQL query that I can run that

Customer Question

I am in need of a recursive SQL query that I can run that will get me all values in two tables. Data looks like this
TABLE 1
SHORTNAME,ENTRYNAME
2021,123456
2021,234567
2021,38392
Table 2
SHORTNAME,ENTRYNAME
123456,93011
123456,93010
123456,93024
38392,129831
38392,12391
What I need is for SHORTNAME of 2021, I need all values directly tied to 2021 as well as ones tied to the values for 2021(123456,234567,38392). Using the data above, the dataset would look like this:
2021 - 123456;234567;38392;93011;93010;93024;129831;12391
This is just one example. I also need it to go atleast 6 levels down, so not only do I need the values tied directly to 2021, but I also need the values tied to the values tied to 2021 and values tied to those values and values tied to those values.
Submitted: 1 year ago.
Category: Programming
Expert:  Ingo U replied 1 year ago.

Hi,

I think I need a little more detail/context to be able to help you.

When you say 6 levels down, do you mean there are 4 more tables linking ENTRYNAME in one table to the SHORTNAME in another?

Or, could the contents of any table be such that the same value of ENTRYNAME can appear as SHORTNAME on other rows of the same table?