2016-04-04 2 views
0

Meine SQL-Tabelle enthält Informationen zu Buchtiteln, und ich möchte das Buch mit dem höchsten Preis auswählen, und ich möchte auch "Das teuerste Buch kostet $ xx.xx" anzeigen. HierMySQL - Kombinieren der Max- und Concat-Funktionen

ist der Code der Tabelle

CREATE TABLE titles 
    (
    title_id CHAR(3)  NOT NULL, 
    title_name VARCHAR(40) NOT NULL, 
    type  VARCHAR(10)   , 
    pub_id  CHAR(3)  NOT NULL, 
    pages  INTEGER    , 
    price  DECIMAL(5,2)   , 
    sales  INTEGER    , 
    pubdate DATE     , 
    contract SMALLINT  NOT NULL, 
    CONSTRAINT pk_titles PRIMARY KEY (title_id) 
)ENGINE = InnoDB; 

ich habe versucht, den Code und es funktioniert nicht.

SELECT CONCAT(MAX('The most expensive book costs ', price)) FROM titles; 

Irgendwelche Tipps?

Antwort