Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to show only multiple of 25 in a sql record?

enter image description here

I have a plenty of record in MedicineStock field. i would like to only show the multiple of 25 in MedicineStock.. multiple of 25 [ 50 – 75 – 100.. etc ]

here’s query i try

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SELECT MedicineID,MedicineName,MedicineStock
FROM c a, MsMedicineType b
WHERE a.MedicineTypeID = b.MedicineTypeID
AND MedicineStock = MedicineStock+25
ORDER BY MedicineName

but it’s not working. i’m still student i try to read the modules the teacher give.. but don’t find any good refreence for it. and already looking for some refreence in google and couldn’t find it. i’m totally stuck. i hope i’ll get to know how to do it. in here. thank you in advance

>Solution :

Use the MOD function which represents the modulus operation in math.
MOD() returns the remainder of a number divided by another number, in your case, all multiples of 25 have 0 as remainder.

SELECT MedicineID,MedicineName,MedicineStock
FROM c a, MsMedicineType b
WHERE a.MedicineTypeID = b.MedicineTypeID
AND MOD(a.MedicineTypeID,25) = 0
ORDER BY MedicineName
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading