New answers tagged alias
Try like SELECT MAX(A.count_supplier), A.id FROM ( SELECT supplier_id as id, COUNT(*) AS count_supplier FROM library.lms_book_details GROUP BY supplier_id ) A GROUP BY A.id; Alias inner COUNT(*) as something different than COUNT as it is good practice to not use it as alias , As i have used count_supplier.
SELECT MAX(COUNT), A.id FROM ( SELECT supplier_id as id, COUNT(*) AS count FROM library.lms_book_details GROUP BY supplier_id ) as A GROUP BY A.id;
You need to specify every column by your self. Example : Table Country and City both have a name column SELECT a.Name AS CountryNane, b.Name AS CityName, c.* FROM Country a JOIN City b ON a.Code = b.CountryCode JOIN CountryLanguage c ON a.Code = c.CountryCode;
If you want to assign an alias to a field you must explicit that field in the list fields of SELECT statement. So, if you have common name field in your three tables, you must explicit. If you use a notation like this SELECT a.* ... you'll show all fields of your aliased table a but the name of field in the header column is the same of the table structure. ...
Top 50 recent answers are included