Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello Experts,

I have two queries and I want them in one stored procedure which will give two datasets as results.
Here are my queries

SQL
SELECT distinct T.TITRANO, C.CIFN, C.CILN, C.CIPHONE,C.CIEMAIL, C.CICLDATE, D.CLDEANO,D.CLDEPHN, V.VIVVIN, V.VIVYEAR, V.VIVMAKE,V.VIVMODEL from DEV.CLCUSINF C, DEV.CLDEAINF D, DEV.CLVEHINF V, DEV.CLTRAINF T where T.TIVID=V.VIVID and T.TICICID=C.CICID and T.TIDEANO=D.CLDEANO;

select distinct T.TITRANO,L.LIDOT, L.LIAPPNBR,L.LITIRSIZ, L.LITIRDPT, L.LIRR, V.VIVIN from DEV.CLLITINF L, DEV.CLVEHINF V, DEV.CLTRAINF T where T.TILTID=L.LILTID and T.TIVID=L.VID and L.VID=V.VIVID


I want the results of two queries in two different resultsets something like a into two datatables.

Can anyone help me with this?

PS:I tried to Tag MySQL but it is not accepting so I tagged SQL. Actually I want a MySQL.
Posted
Updated 3-Mar-15 4:02am
v4
Comments
CHill60 3-Mar-15 10:10am    
Why not have two stored procedures - applying Separation of concerns[^] principle?
Or populate two tables which can be queried outside the SP.
sudevsu 3-Mar-15 10:14am    
How to "populate two tables which can be queried outside the SP" ?
CHill60 3-Mar-15 10:17am    
Just use "select .. into" to create the tables or "insert into" if they already exist. Then those tables will be on the database as any other.
sudevsu 3-Mar-15 10:22am    
Thank you.I am not looking for this.

1 solution

I hope you are looking for this,
try it,

http://www.devasp.net/net/articles/display/1377.html[^]
 
Share this answer
 
Comments
sudevsu 3-Mar-15 10:23am    
Thank you. I have been there. I actually want something like that but in MySQL. I tried it as well But didn't work.
King Fisher 3-Mar-15 10:30am    
i hope that article gives enough information for you.
sudevsu 3-Mar-15 10:34am    
Not really. But Thank you
King Fisher 3-Mar-15 10:38am    
Actually i don't have MySQL to check out. sorry dear!!
let' wait for some Response.;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900