+ 2

SQL execute

I can t execute this request SELECT NOMOUVR FROM OUVRAGE, TARIFER, (SELECT MAX(PRIXVENTE) FROM TARIFER) AS R1 WHERE OUVRAGE.NUMOUVR=TARIFER.NUMOUVR AND TARIFER.PRIXVENTE=(SELECT MAX(PRIXVENTE) FROM TARIFER).PRIXVENTE they show me that i have an error in line 4 plz heeeeelp

5th Apr 2020, 6:25 PM
safae safa
safae safa - avatar
5 odpowiedzi
+ 3
The formatting in the posted text makes it hard to determine which line is line 4. I guess it is this line: AND TARIFER.PRIXVENTE=(SELECT MAX(PRIXVENTE) FROM TARIFER).PRIXVENTE Here I see a misplaced field name: "TARIFER).PRIXVENTE" should be "TARIFER)".
5th Apr 2020, 8:51 PM
Brian
Brian - avatar
+ 3
We don't know your database, but I think there are more syntax error there. That's what you mean? SELECT o.numouvr, max(t.prixvente) FROM ouvrage o, tarifer t WHERE o.numouvr = t.numouvr AND o.prixvente = (SELECT max(t.prixvente) FROM tarifer)
5th Apr 2020, 8:58 PM
dozule
dozule - avatar
+ 1
Akansha Srivastava this uses a valid form of query that is called Subbquery. You can learn more about it from this reference: https://dev.mysql.com/doc/refman/8.0/en/subqueries.html See also Derived Tables: https://dev.mysql.com/doc/refman/8.0/en/derived-tables.html
27th Apr 2020, 3:05 PM
Brian
Brian - avatar
- 1
select can't be used b/w a statement
27th Apr 2020, 1:38 PM
Akansha Srivastava
- 1
whole statement is wrong
27th Apr 2020, 1:41 PM
Akansha Srivastava