Results 1 to 3 of 3
  1. #1
    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

  2. #2
    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.

  3. #3
    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";



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •