Last post Sep 03, 2013 04:23 AM by yogesh.bhalerao
Sep 03, 2013 03:53 AM|EddzAkl|LINK
I'm looking for some help in a matter i can't solve it.
i created a stored procedure to select data from a table called "applicant"
and it work great
this is the code below:
/****** Object: StoredProcedure [dbo].[PROC_GETALLAPPLICANTS] Script Date: 09/03/2013 10:50:58 ******/
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
-- Batch submitted through debugger: SQLQuery25.sql|7|0|C:\Users\supportadmin\AppData\Local\Temp\~vs29E1.sql
ALTER PROCEDURE [dbo].[PROC_GETALLAPPLICANTS]
select ID,FIRSTNAME,LASTNAME,APPLYDATE from APPLICANT order by ID Asc
i added a new table called "AF", the two tables are related with a unique column:"applicant_id"
how to make the store procedure to select from 2 tables and show it in one grid view with the same order "ID Asc"
Sep 03, 2013 03:59 AM|MetalAsp.Net|LINK
Simply use an INNER JOIN (or a LEFT OUTER JOIN depending on your data/need) on the applicant_id column.
Sep 03, 2013 03:59 AM|abivenkat|LINK
Use joins and select columns from two tables and add an order by ID at the end of your query.
mark as answer if my post was helpful
Sep 03, 2013 04:23 AM|yogesh.bhalerao|LINK
Use Join For Getting Data From Two Table i.e APPLICANT & AF .
The Query Shoild Like This.
select A.ID,A.FIRSTNAME,A.LASTNAME,A.APPLYDATE ,B.applicant_id
from APPLICANT A
INNER JOIN AF B ON A.applicant_id=B.applicant_id
order by A.ID Asc