techtheatre Posted May 5, 2007 Share Posted May 5, 2007 I am trying to find out how many orders in my shopping cart database have a particular "Status". I can't seem to get this rather simple query correct. Here is some of what i have tried: SELECT COUNT(Status) FROM InvoiceData HAVING Status='Processing Payment' GROUP BY Status; SELECT COUNT(*) FROM InvoiceData WHERE Status='Processing Payment' GROUP BY Status; SELECT COUNT(*) FROM InvoiceData HAVING Status='Processing Payment' GROUP BY Status; My table is "InvoiceData" and there are several columns, but one is called "Status"...There are a variety of possible values for Status in the table. THANKS! I feel like an id10t that i cannot get this correct. Maybe i should try sleeping... :-\ Link to comment https://forums.phpfreaks.com/topic/50155-solved-easy-syntax-error-using-count-having-and-group-by/ Share on other sites More sharing options...
techtheatre Posted May 5, 2007 Author Share Posted May 5, 2007 I am an idiot... here is the correct query: SELECT COUNT(*) FROM InvoiceData WHERE Status='$value'; I really am going to bed now...this is ridiculous... Link to comment https://forums.phpfreaks.com/topic/50155-solved-easy-syntax-error-using-count-having-and-group-by/#findComment-246310 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.