Wrox Programmer Forums
|
Moderated Pro PHP This is a moderated forum for discussing advanced, professional level issues with PHP. Your posts will not appear until a moderator approves them. Posts that are not the right level for this forum will be responded to and you'll be asked to post them in the [url="http://p2p.wrox.com/sql-server-2000-20/9"]Beginning PHP[/url] forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Moderated Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2007, 04:19 PM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Complex Query....

hi

This is what i am trying to do...


User selects start and end date....from 25 to 27....

+---------+------+-----------+
| day_Num | qty | room_Type |
+---------+------+-----------+
| 25 | 2 | single |
| 25 | 0 | double |
| 25 | 0 | ensuite |
| 26 | 6 | single |
| 26 | 13 | double |
| 26 | 5 | ensuite |
| 27 | 1 | single |
| 27 | 1 | double |
| 27 | 1 | ensuite |
+---------+------+-----------+

room_Type = double and ensuite has ZERO qty....so all the related data with double and ensuite...should not be printed...so the OUTPUT should be:

+---------+------+-----------+
| day_Num | qty | room_Type |
+---------+------+-----------+
| 25 | 2 | single |
| 26 | 6 | single |
| 27 | 1 | single |
+---------+------+-----------+

And from here then... the lowest qty should be printed out, so the FINAL OUTPUT should be:

+---------+------+-----------+
| day_Num | qty | room_Type |
+---------+------+-----------+
| 27 | 1 | single |
+---------+------+-----------+

Anyone know what the query should be?






Similar Threads
Thread Thread Starter Forum Replies Last Post
complex query... help plz hello MySQL 1 April 28th, 2007 05:48 AM
complex query g_vamsi_krish SQL Language 3 February 27th, 2006 10:48 AM
Help need with designing this complex query method Access 2 July 1st, 2005 05:29 AM
query too complex [email protected] Access 3 August 28th, 2003 09:01 AM
COMPLEX QUERY PROBLEM nikosdra Classic ASP Databases 2 July 28th, 2003 02:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.