I need some assistance in writing a query - for What is the most recent location of the person with the most debt on their credit card. This is my first time using forum and I am new to SQL Any and all help is appreciated
Asked
Active
Viewed 279 times
-5
-
4Show us what you have so far. Without knowing that or your database schema no one here can help you. – Ganz7 Aug 14 '15 at 17:20
-
1Welcome to Stackoverflow! Normally on SO for a question like this, it is typically required that you demonstrate what you currently have in terms of your query, and indicate where you're having trouble, and/or what is the expected behaviour versus the observed behaviour. Otherwise, its difficult to tell whether someone is attempting to have their work done for them, or has a genuine question. – Paul Richter Aug 14 '15 at 17:21
-
2You should read [How to ask a good question](http://stackoverflow.com/help/how-to-ask) – Juan Carlos Oropeza Aug 14 '15 at 17:23
-
See http://stackoverflow.com/questions/31930105/row-count-to-start-over-based-on-order for an example of a well formatted and complete question. – APH Aug 14 '15 at 17:40
-
My table looks like thisTransaction ID | Date | Person ID | Credit | Location – JMP Aug 14 '15 at 17:52
-
And i am a bit confused about getting the MOST RECENT date and of the person with the MOST credit because of there are two aggregate functions together – JMP Aug 14 '15 at 17:53
1 Answers
0
There's nothing we can really do for you unless you show us what you have, in terms of your database. This also isn't a place for getting people to do your work for you.
What you need to do for this problem is a simple SELECT query, and using the max function find the record with the highest credit card debt, and the name of that person. http://www.w3schools.com/sql/sql_func_max.asp
Above is a site where you can look at how to use the MAX function,, and even practice it with some fake data.
This might look like
:SELECT Name, MAX(CCDEBT) FROM MyDatabase

Sillybear
- 1
- 2