eswar rao

eswar rao

  • 1.6k
  • 98
  • 19.4k

How to get records from two tables using ASP.NET

Mar 20 2016 9:59 AM
hi friends ,


i have a one problem..that is i have two tables .

1.student 2 .attendance

i want results from two tables ..i mean who's absent on particular date and group and batch..

student tables is haveing (id,group,batch)
attendance table having (id,date)

i want absentees data with sorting by group and batch and date..please tell me how to write a query for that..
 
 

What I have tried:

SELECT id,gender,vid,fname,mobino,fathername,date,batch,group,FROM tbl_studentenroll ee WHERE not exists (SELECT vid,date FROM tbl_attendance aa where aa.vid=ee.vid and aa.date='" + ddl_date.SelectedItem.Text + "' and ee.group='" + ddl_group.SelectedItem.Text + "' and ee.batch='" + ddl_batch.SelectedItem.Text + "' );

but it is not sorting results it is shows all groups and batchs absents 

Answers (3)