You are here: Re: An SQL search « All PHP « IT news, forums, messages
Re: An SQL search

Posted by Brian on 08/26/05 01:47

"Tyrone Slothrop" <ts@paranoids.com> wrote in message
news:mrjrg1d79m0v9d2c3em62mri3d23mt2qb7@4ax.com...
> On Thu, 25 Aug 2005 11:17:32 GMT, "Brian" <not@given.com> wrote:
>
>>Hi all
>>
>>I hope I can explain this properly.....
>>
>>I'm trying to run a search on a MySQL table that checks if item
>>were out of stock between 2 dates and reports it
>>
>>This is what it need to do
>>
>>The fields are
>>timestamp = the timestamp to search on
>>status = the status code, 'o' if out of stock
>>ord = the number ordered
>>description = the item description
>>
>>I need to say show me items between startday and endday that were out of
>>stock
>>and how many were ordered
>>
>>e.g.
>>
>>Item A = 400 ordered
>>Item B = 250 ordered
>>Item C = 100 ordered
>>
>>What's the best way to do this without have vapours SQL queries?
>>
>>Any help would be great
>>
>>Brian
>
> The query is fairly simple:
> SELECT * FROM products WHERE (timestamp <= $enddate AND timestamp >=
> startdate) AND status = 'o';
>
> However, if you don't know how to structure the query, I have the
> feeling you will have a number of other questions. ;-)

sorted it out, this worked

SELECT product,description,SUM(ord) AS productnumbers FROM $customer WHERE
(timestamp >= $sdate) AND (timestamp <= $edate) AND (status = 'O') GROUP BY
PRODUCT,DESCRIPTION ORDER BY product

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация