Reputation: 1138
I have have problems with 2 sql queries.
Query 1: I need to extract the maximum payment and the mode of payment from a table called payments.
My query:
SELECT MAX(totalPayment) AS MAXIMUM_PAYMENT, FROM Payments
Problem : I want to get the mode of payment as well but I can only get the maximum payment.
Query 2: I need to extract the nurses who are not looking after any admitted patients.
My query:
SELECT firstName , lastName FROM Nurse_Information
Problem: I have not completed the above query since I don't know what to give for the where clause. I have a column called admittedPatient_No
, in the Nurse_Information
table.
If a nurse is not looking after an admitted patient, the column admittedPatient_No
stays null
.
How do I solve the query problems?
Thank you for your time.
Upvotes: 0
Views: 40
Reputation: 20330
Something like
SELECT Payment_method, MAX(totalPayment) AS MAXIMUM_PAYMENT FROM Payments
Group By Payment_method
will do the first the second isn't an aggregate unless you missed something in your question
Select firstName,lastName From NurseInformation
Where admmitedPatient_no is null
Upvotes: 1