|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Count items
Hi all!
How would I count the items on my order details table and verify if all are marked "SHIPPED" in one query. Code:
SELECT * FROM ORDER_DETAILS WHERE orderid = "333333" |
|
#2
|
||||
|
||||
|
add another condition to your query:
Code:
SELECT * FROM ORDER_DETAILS WHERE orderid = "333333" AND shippingstatus = 'shipped' for example
__________________
MySQL - reformat varchar dates to proper date type || MySQL - room vacancies || output results with column names with mysql only Latest row per group || Deleting duplicates || Gaps in auto increment column My site: sql help articles |
|
#3
|
|||
|
|||
|
Hi .Thanks for the help. I understand how to SELECT all the "SHIPPED" items. I'm trying to count the line items and then verify if each line item is marked with the status of "SHIPPED". How can I do that.
|
|
#4
|
||||
|
||||
|
Code:
SELECT COUNT(*) AS items
, COUNT(CASE WHEN status = 'shipped'
THEN 937 END) AS shipped
FROM order_details
WHERE orderid = "333333"
|
|
#5
|
|||
|
|||
|
Thanks so much
![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Count items |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|