Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Homework GimmeCode+
I have two tables, Students and Fees. Students table contains Student Related Data and Fees table contains Fee record of Students.
 
Actually, My problem is i want to show defaulter students who have not paid this month fee.
 
Sol. seems to me is :
I want to search all Students first from Students table, then query should search in Fee table for students who have not paid their fee of this month of Current Year..\
 
My Question is How to write query for my above requirement.
Posted 6-Feb-13 23:08pm
Edited 6-Feb-13 23:10pm
v2
Comments
aspnet_regiis -i at 7-Feb-13 4:10am
   
You can use Sql Server Management Studio to write the query..Also NotePad++ will be a good editor
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There are many ways you could do this. One way could be to retrieve the data from both tables into structures in your code, then you could iterate through them looking for instances where you have a value in your student class but no corresponding entry in the fee class. You could do this, but I wouldn't recommend it.
 
Another way to do this would be to use the features of SQL and perform a select that looked at both tables simultaneously, possibly joining them together somehow; taking into account that what you are looking for wouldn't be present, so your joining will need to take this into account - possibly giving preference to the table at the left or right hand side of the joining.
  Permalink  
Comments
Harpreet_125 at 7-Feb-13 4:29am
   
can you please tell me how to do this practically..
Pete O'Hanlon at 7-Feb-13 4:39am
   
I already have - the keywords you need are highlighted in there. I'm not doing your homework for you - 2 minutes with Google using those keywords will tell you everything you need to know.
__TR__ at 7-Feb-13 4:49am
   
I would recommend you to refer the below links to learn SQL. Then go through the above solution given by Pete. That should give you an idea on how to approach your problem.
SQL Tutorial[^]
SQLCourse.com[^]
Pete O'Hanlon at 7-Feb-13 4:58am
   
I wish you'd added that as a solution so I could 5 it.
__TR__ at 7-Feb-13 6:01am
   
I posted the comment as a solution as per your suggestion (not for the upvote), but ended up getting around 500 rep points for that. Went to Site Bugs / Suggestions forum to report it and already found a bunch of messages explaining the same issue. I hope this issue gets fixed soon.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I would recommend you to refer the below links to learn SQL. Then go through the above solution given by Pete. That should give you an idea on how to approach your problem.
SQL Tutorial[^]
SQLCourse.com[^]
 
You can find more resources on SQL in Google[^] or you can refer to beginner articles on SQL in CP here[^]
  Permalink  
Comments
Pete O'Hanlon at 7-Feb-13 6:11am
   
My 5.
__TR__ at 7-Feb-13 6:50am
   
Thank you.

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

  Print Answers RSS
0 Mathew Soji 330
1 BillWoodruff 260
2 Sergey Alexandrovich Kryukov 240
3 OriginalGriff 216
4 Afzaal Ahmad Zeeshan 208
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,028
3 Manas Bhardwaj 4,539
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web02 | 2.8.1411019.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100