GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Jan-2008, 07:40
scottparkin69 scottparkin69 is offline
New Member
 
Join Date: Jan 2008
Posts: 2
scottparkin69 is on a distinguished road

Help With Mysql Query with 2 fields


Hi All

I'am having problem's how to work out what seems to be a simple Query i writing a simple database to keep track of our vast cartridge collection with set order levels

the 2 field in question are <Qty> and <Order Level> .I'm wanting to display all items that the number in <qty> is equal or lower then <Order Level>

Thanks in advance
  #2  
Old 08-Jan-2008, 10:29
NHDriver4's Avatar
NHDriver4 NHDriver4 is offline
New Member
 
Join Date: Jan 2008
Location: New Hampshire, USA
Posts: 10
NHDriver4 will become famous soon enough

Re: Help With Mysql Query with 2 fields


Hi Scott.

Are these two fields in the same table? Provide an example of the database layout, and I could help you better. If they are in the table, then this should work for you:

Code:
SELECT * FROM items WHERE items.qty <= items.orderlevel

The above code returns only the HP cartridge on the following database, because that's the one with quantity being lower than orderlevel:
Code:
id name qty orderlevel 1 Cannon Xp-1200 5 4 2 HP LJ 1255 5 6
  #3  
Old 09-Jan-2008, 01:43
scottparkin69 scottparkin69 is offline
New Member
 
Join Date: Jan 2008
Posts: 2
scottparkin69 is on a distinguished road

Re: Help With Mysql Query with 2 fields


That's great thanks alot works perfectly
 
 

Recent GIDBlogWelcome to Baghdad by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql insert query in php mrjameer MySQL / PHP Forum 0 20-Nov-2006 14:23
combining 2 fields in a single mysql select query mrjameer MySQL / PHP Forum 1 28-Sep-2006 19:38
Cpanel downgrade MYSQL 4.1.X to MySQL 4.0.xx Webhosting-live Web Hosting Forum 1 01-Sep-2006 02:54
Tricky MySQL query involving multiple primary keys... TreyAU21 MySQL / PHP Forum 4 18-Apr-2006 09:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:10.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.