user1311286
user1311286

Reputation:

MySQL find tuples with the largest value in a specif row, where there are multiple tuples that meet the creiteria

Relations: Product(maker, model, type) Laptop(Model, price, speed, ram, hd, screen) PC(model, price, speed, ram, hd) Printer(model,price, color, price)

I am trying to find the printers with the highest price. I know I can find the printer with the highest price but how might I do this if there are multiple tuples that share the condition (highest price)

What I have tried:

SELECT model FROM printer HAVING COUNT(*) >= 1 WHERE price > all;

This is a terrible attempt I know, I am still trying to learn. But I can't do much when I come to a complete standstill.

Upvotes: 0

Views: 115

Answers (1)

Marco
Marco

Reputation: 57593

I don't know if I understand your needs:

SELECT model FROM printer
WHERE price = (SELECT MAX(price) FROM printers)

Upvotes: 1

Related Questions