![]() ![]() ![]() Select * from order_details left outer join purchase_details on purchase_details.order_id=(select order_id from purchase_details where billing_amount=(select max(billing_amount) from purchase_details)) ![]() | order_id | cust_id | delivery_address | delivery_date | pur_id | order_id | item_type | qty | billing_amount | Query 2: select order_id from purchase_details where billing_amount=(select max(billing_amount) from purchase_details) Query 1: select max(billing_amount) from purchase_details So please bear with my horrible queriesâ–ˇ) So please do not judge my queries based on how silly they are or the inconvenience they cause. (It should be noted here that I am completely new to SQL and don't know most of the concepts out there. ![]() I want the tables order_details and purchase_details left joined and should only give me the tuple which has the maximum billing_amount. REFERENCES `customer_details` (`cust_id`) `delivery_date` datetime NOT NULL DEFAULT (_cp850''), `delivery_address` varchar(200) NOT NULL, `order_id` int(10) NOT NULL AUTO_INCREMENT, `pur_id` int(10) NOT NULL AUTO_INCREMENT, `cust_email_id` varchar(60) DEFAULT NULL, `cust_contact_2` bigint(11) DEFAULT NULL, `cust_id` bigint(11) NOT NULL AUTO_INCREMENT, I have the following set of tables in a database called order_mgmt_sys (Please note that database is static and I can't alter the tables) mysql> show tables This or this questions do not answer my doubt. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |