Forums Register Login

SQL Query

+Pie Number of slices to send: Send
I am a newbie is sql.

I have two tables called test_master and test_detail.
Both tables contains pos_id as common field.
In test_detail got sub_id and to get the people under a given pos_id, I join with pos_id of test_master.

In the where condition, when I give the pos_id, it's returning only
the first level. How can I get the second level and get all the levels?


Any help is highly appreciable.

Looking forward to hear from you.

Thanks

Newbie
[ June 09, 2005: Message edited by: Bear Bibeault ]
+Pie Number of slices to send: Send
I edited your post to remove all the urgent urgent urgent stuff.

Please read this.
+Pie Number of slices to send: Send
Cosmos,
For the second level, you can use a nested query. For an arbitrary number of levels, you need a stored procedure (or the equivalent code in Java.)
+Pie Number of slices to send: Send
Hi Cosmos,

I'm not sure I understood the table structure you described.

You can also use hierarchical queries, if your db system supports it (Oracle does : you can use a CONNECT BY clause)(see example at Oracle site).

Cheers - Nic
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 763 times.
Similar Threads
newbie question : about EJB and Database
Best Design Patern for Multiple SQL Statements
Newbie SQL tutorial
Invalid Object exception
RESTful web services and SQL
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:55:26.