How to fetch particular values from a column among different values?
If you are having a table named Status_details
TABLE NAME :Status_details
OrderId EmployeeName EmployeeId Status BillingNumber Date
101 Selvan 120021 Hand Delivery CTS02153 2015-07-01
102 Selvam 120022 Dispatched CTS02154 2015-07-02
103 Ananthan 120023 Cancelled CTS02125 2015-07-03
104 Anand 120024 Cancelled CTS02169 2015-07-04
105 Karthi 120025 Dispatched CTS02185 2015-07-05
107 Thamarai 120027 Rejected CTS02155 2015-07-06
Whatever status as dispatched and cancelled you want to list all from the table based upon the given from and to date
QUERY
Select * from status_details where date between "2015-06-30" and "2015-07-15" AND status IN('dispatched', cancelled)
It will list the particular column values contains dispatched and cancelled.
OrderId EmployeeName EmployeeId Status BillingNumber Date
102 Selvam 120022 Dispatched CTS02154 2015-07-02
103 Ananthan 120023 Cancelled CTS02125 2015-07-03
104 Anand 120024 Cancelled CTS02169 2015-07-04
105 Karthi 120025 Dispatched CTS02185 2015-07-05
THANK YOU
THIS POST MAY HELP SOME ONE AROUND THE WORLD.
TABLE NAME :Status_details
OrderId EmployeeName EmployeeId Status BillingNumber Date
101 Selvan 120021 Hand Delivery CTS02153 2015-07-01
102 Selvam 120022 Dispatched CTS02154 2015-07-02
103 Ananthan 120023 Cancelled CTS02125 2015-07-03
104 Anand 120024 Cancelled CTS02169 2015-07-04
105 Karthi 120025 Dispatched CTS02185 2015-07-05
107 Thamarai 120027 Rejected CTS02155 2015-07-06
Whatever status as dispatched and cancelled you want to list all from the table based upon the given from and to date
QUERY
Select * from status_details where date between "2015-06-30" and "2015-07-15" AND status IN('dispatched', cancelled)
It will list the particular column values contains dispatched and cancelled.
OrderId EmployeeName EmployeeId Status BillingNumber Date
102 Selvam 120022 Dispatched CTS02154 2015-07-02
103 Ananthan 120023 Cancelled CTS02125 2015-07-03
104 Anand 120024 Cancelled CTS02169 2015-07-04
105 Karthi 120025 Dispatched CTS02185 2015-07-05
THANK YOU
THIS POST MAY HELP SOME ONE AROUND THE WORLD.
Comments
Post a Comment