If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to get the first record that meet my criteria??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-04, 00:12
Bassam72 Bassam72 is offline
Registered User
 
Join Date: Mar 2004
Location: Malaysia
Posts: 3
How to get the first record that meet my criteria??

Hello Guys,
I have table called Gateway with three fields: Aliase_No, Gateway_IP and Gateway_MAC. I want to retrieve the first record that its Gateway_IP is 0.0.0.0, so anyone can tell me what is the SQL statement that should I write to get that record???


Thanks
Bassam72
Reply With Quote
  #2 (permalink)  
Old 03-15-04, 04:12
reneeb reneeb is offline
Registered User
 
Join Date: Jan 2004
Location: Germany
Posts: 167
Code:
SELECT * FROM table WHERE Gateway_IP = '0.0.0.0' LIMIT 1
__________________
board.perl-community.de - The German Perl-Community
Reply With Quote
  #3 (permalink)  
Old 03-15-04, 22:46
lslars31 lslars31 is offline
Registered User
 
Join Date: Jun 2003
Location: Minnesota
Posts: 61
you dont need the LIMIT at the end just: SELECT * FROM $table WHERE Gateway_IP='0.0.0.0'

Well I guess you could add it for security reasons.
__________________
Mr. Lars
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On