Unix Technical Forum

Stored Procedures using 2 queries, the second dependent on the results of the first

This is a discussion on Stored Procedures using 2 queries, the second dependent on the results of the first within the MySQL forums, part of the Database Server Software category; --> Hi all, I have a database with two tables, called cost and costdesc. For each record in cost, there ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:26 AM
Rich Mogy
 
Posts: n/a
Default Stored Procedures using 2 queries, the second dependent on the results of the first

Hi all,
I have a database with two tables, called cost and costdesc. For each
record in cost, there can be 1 to 100 records in costdesc, each of these
records having parts of the narrative of the cost.

I want to create a stored procedure that will select records from the cost
table, and then, for each record in the result set, select records from the
costdesc table and concatenate them into one string, thus:

Cost record -- index, person authorizing cost, amount of cost, date of cost

Costdesc record -- index, line 1, narrative 1
index, line 2, narrative 2
index, line 3, narrative 3


Result set

index, person authorizing cost, amount of cost, narrative 1 narrative 2
narrative 3


Go to next cost record.


Any assistance would be appreciated.

Thanks in advance.

Richard Mogy


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com