Results 1 to 3 of 3
Thread: MySQL Select WHERENOT?
-
04-23-2005, 06:40 PM #1Web Hosting Master
- Join Date
- Dec 2003
- Location
- Miami, FL
- Posts
- 3,262
MySQL Select WHERENOT?
Is there anyway to display information that is NOT meeting a certain query?
Say I have 10,000 rows. Column A says "13" but there are few rows in Column A that are "14". I'd like to just display all the rows w/ the number 14 in it?
Thanks
-
04-23-2005, 07:47 PM #2Junior Guru
- Join Date
- Aug 2004
- Location
- Here & There
- Posts
- 175
Rob, I'm not sure if the syntax will work for MySQL but since I'm a self appointed MSSQL guru this is what I would write for my query.
Show all rows where field A = 14:
SELECT A FROM tblMyData WHERE A=14
Show all rows where field A <> 13:
SELECT A FROM tblMyData WHERE A<>13
Show rows where field A equal to several values in the list or
expression from sub query:
SELECT A FROM tblMyData WHERE A IN (14, 15, 16)
Hope this helps.
-
04-24-2005, 12:58 AM #3Newbie
- Join Date
- Apr 2005
- Posts
- 11
easy;
PHP Code:$query="SELECT * FROM table WHERE ID!='13'";
$result=mysql_query($query);
while($data=mysql_fetch_array($result)){
$ID=$data['ID'];
echo "$ID<BR>\n";
}