MySQL using Is Null and Is Not Null

Hi
I am using mySQL and PHP to design a web site. On one of the
pages I want to able to display a list of records based on a date
field either having a date inputted or not having a date inputted.
I want the user to be able to select these options on the page via
a list box as below
Label Value
Open Is Null
Closed Is Not Null
However I can not seem to get this to work (sql below), is
the syntax correct and should it be a GET or POST variable eg
$_POST['ListBox']. Hope this makes sense.
SELECT *
FROM tbltable
WHERE datefield variable
Thanks

Change the order of your conditions
SELECT name,
       lname,
       CASE WHEN creditcard IS NULL AND credit_used IS NULL THEN
         'Sell both'
       WHEN creditcard IS NULL THEN
         'Sell Card'
       WHEN credit_used IS NULL THEN
         'Sell Credit'
       ELSE
         'No Action'
       END "Action"
  FROM customers;

Similar Messages

  • Filter by form shows only "Is Null" and "Is Not Null" value in split database

    Hello,
    I have a SPLIT database into FE (forms, queries...) and BE (tables with data) ready for distribution.
    PROBLEM
    When "Filter by Form" is chosen
    only 2 values are available in combobox filter ("Is Null", "Is Not Null"). All other functionalities of the form work fine (data display), which means that tables are linked
    correctly.
    In the UNSPLIT database "Filter by Form" works OK (i.e. comboboxes show lists of possible values to choose from).
    All the forms (and queries) behave like this.
    Recordsource of all forms are queries.
    Type of filtered fields => text (no memo fields, no comboboxes)
    QUESTION:
    What is the reason of this behavior and how can it be fixed so that "Filter by Form" works in SPLIT database (and displays available values in comboboxes)?
    Thank you for help.

    Hi,
    this is the default behaviour with linked tables. To change it:
    open the form in design view
    select the text box you want to use for the filter
    in the properties of the text box click at the data tab and change the FilterLookUp property from "Database default" to "Always"
    See also
    https://msdn.microsoft.com/en-us/library/office/ff194556(v=office.15).aspx.
    cu
    Karl
    Access FAQ (de/it): http://www.donkarl.com
    Access Lobby: http://www.AccessDevelopers.org

  • I had Premier pro given me by the college I attend and do no use wi fi and do not use cloud. My laptop completely died and will be sent back to Apple for exchange. How can I reinstall Premier Pro on a new Apple computer since the old one is completly dead

    I had Premier pro given me by the college I attend and do no use wi fi and do not use cloud. My laptop completely died and will be sent back to Apple for exchange. How can I reinstall Premier Pro on a new Apple computer since the old one is completly dead and could not be unregistered?

    Hi,
    You have not specified which version of Premiere Pro was given to you. If you don't have the disc (which i suppose you don't have) you will have to download it online.
    As far as your registration is concerned, for Premiere Pro CS6 or earlier you will have to reach Adobe chat support for further help: http://helpx.adobe.com/contact.html
    For Premiere Pro CC and later, you will not have much problems reactivating it.
    Thanks,
    Rameez

  • How I can delete my account from Itunes Store? [I am not using it anymore and will not]]

    How I can delete my account from Itunes Store? [I am not using it anymore and will not]

    Just stop using it and remove your payment info.
    There is no need to do more.

  • Is there a way to play video clips that use adobe flash and if not when are you going to resolve your problem with them ? I won't buy another apple product until you do and I Know I,m not the online.

    Is there a way to play video clips that use adobe flash and if not when are you going to resolve your problem with them ? I won't buy another apple product until you do and I Know I,m not the only one.

    Use the search feature and type in Flash and there are like thousands of posts on this.
    You seem to think you are addressing Apple with your post.  This is a user forum and we are all users just like you.

  • I have 2 games Words with Friends and Cityville that receives a Pop-up message form iTunes...  "Connect to iTunes to use Push Notifications" and will not allow me to exit out of the app or play.  How can I get this message to STOP?

    I have 2 games Words with Friends and Cityville that receives a Pop-up message form iTunes...  "Connect to iTunes to use Push Notifications" and will not allow me to exit out of the app or play.  How can I get this message to STOP?

    Yes - I connected my phone to my computer / Itunes and went into the apps section, but from there I have no idea how to manage the push notifications.  I even tryied going into itunes that is installed on my phone.  I still cannot find anyplace to manage these popups.  I have also gone into settings - notifiations - and tried turning all notifications for these apps all off but that didnt work either.  Any guidance is MUCH appreciated - Im not sure where to go from here.

  • About a year ago we purchased a used macbook pro and can not get music to transfer from iPhones to mac

    about a year ago we purchased a used macbook pro and can not get music to transfer from iPhones to mac

    how can i get All music transferred? even non purchased

  • I was updating my iphone 4s on my computer and there was an error and my phone has the connect to itunes symbol but will not connect to itunes on my computer.  I am unable to use my phone and im not sure what to do..

    I was updating my iphone 4s on my computer and there was an error and my phone has the connect to itunes symbol but will not connect to itunes on my computer.  I am unable to use my phone and im not sure what to do..

    See this support document for help. You may have to do this more than once. http://support.apple.com/kb/HT1808

  • Recently in the Bahamas where I helped a friend with his new iPad. We could not find Bahamas in initial setup so we used United States and could not enter Visa/MC billing address in Bahamas. iTunes rejected, billing info is not what's on file. What to do?

    Recently in the Bahamas where I helped a friend with his new iPad. We could not find Bahamas in initial setup so we used United States and could not enter Visa/MC billing address in Bahamas. iTunes rejected, billing info is not what's on file. What to do?

    Just to recap, this is a collection of ports I have collected over time for people who needed this information when setting up the HP ePrint app so that they could view their email from within the app.  I am certain other applications also need this information.  Although lengthy, I could not find a more comprehensive place to retrieve this information.  Feel free to post additional information, faulty information, or other related topics below as this is simply a collection of data and it would be practically impossible to test all of them. Thank you!
    Don't forgot to say thanks by giving "Kudos" if I helped solve your problem.
    When a solution is found please mark the post that solves your issue.
    Every problem has a solution!

  • HT1386 I backup my boss iphone to my pc, i copy the backup file to his PC, can he restore the backup to his iphone using his pc and will not reset his iphone.  Thanks so much

    Hi,
    I backup my boss iphone to my pc, i copy the backup file to his PC, can he restore the backup to his iphone using his pc and will not reset his iphone.  Thanks so much

    Put the device in DFU mode and restore.
    When he gets back to the computer that he normally syncs with, he can restore from his backup.  Everything since that last backup will be lost.
    Start apologizing now... keep it up for a few months to several years.
    Then hopefully you will learn to leave other peoples stuff alone.

  • HT204088 I was using Netflix trial and was not notified that trial was over and being charged  how do I cancel Netflix ?

    I was using Netflix trial and was not notified that trial was over and now being charged . I am not satisfied with Netflix and had no intention to subscribe to Netflix . How do I cancel and get credit ?

    ''(In case you meant this, but probably not.)''
    Bookmarks all Tabs now appears if you right-click a tab.
    You also can use Ctrl+Shift+d to call up that dialog.
    Certain items on the classic menus have become invisible when you use the mouse. I have no idea why that is; perhaps they didn't want to duplicate the right-click on tab menu item? Anyway, if you open the bookmarks menu with the keyboard, by pressing Alt+b, then you will see Bookmark All Tabs.

  • Difference between Primary Key and Unique+Not NUll

    Hi Guys,
    Is there any difference the column being declared as primary key or unique+NOT NULL.
    Please let me know the internal and application point of view.
    Thanks in advance!
    Ranjan

    957590 wrote:
    Ok,Thanks however I donot think Primary key uses unique indexPK uses whatever index you specify - unique or not (as long as index is on proper column(s)). However, if you do not specify any index, PK creates unique index:
    SQL> create table tbl(
      2                   id number,
      3                   name varchar2(10)
      4                  )
      5  /
    Table created.
    SQL> alter table tbl
      2    add constraint tbl_pk
      3      primary key(
      4                  id
      5                 )
      6  /
    Table altered.
    SQL> select  index_name,
      2          uniqueness
      3    from  user_indexes
      4    where table_name = 'TBL'
      5  /
    INDEX_NAME                     UNIQUENES
    TBL_PK                         UNIQUE
    SQL> select  constraint_name,
      2          index_name
      3    from  user_constraints
      4    where table_name = 'TBL'
      5  /
    CONSTRAINT_NAME                INDEX_NAME
    TBL_PK                         TBL_PK
    SQL>  alter table tbl
      2    drop primary key
      3  /
    Table altered.
    SQL> create index tbl_non_unique_pk_index
      2    on tbl(
      3           id
      4          )
      5  /
    Index created.
    SQL> alter table tbl
      2    add constraint tbl_pk
      3      primary key(
      4                  id
      5                 )
      6        using index tbl_non_unique_pk_index
      7  /
    Table altered.
    SQL> select  index_name,
      2          uniqueness
      3    from  user_indexes
      4    where table_name = 'TBL'
      5  /
    INDEX_NAME                     UNIQUENES
    TBL_NON_UNIQUE_PK_INDEX        NONUNIQUE
    SQL> select  constraint_name,
      2          index_name
      3    from  user_constraints
      4    where table_name = 'TBL'
      5  /
    CONSTRAINT_NAME                INDEX_NAME
    TBL_PK                         TBL_NON_UNIQUE_PK_INDEX
    SQL> insert
      2    into tbl
      3    values(
      4           1,
      5           'A'
      6          )
      7  /
    1 row created.
    SQL> insert
      2    into tbl
      3    values(
      4           2,
      5           'B'
      6          )
      7  /
    1 row created.
    SQL> insert
      2    into tbl
      3    values(
      4           1,
      5           'C'
      6          )
      7  /
    insert
    ERROR at line 1:
    ORA-00001: unique constraint (SCOTT.TBL_PK) violated
    SQL> SY.

  • How to combine two conditions :  Exists and Item not null ?

    Hello !
    I have a flash chart region that I would like to display only if two conditions are both true.
    The first condition is this one :
    Exists (SQL query returns at least one row) :
    select 1
    from    observatoire.fiche aa, observatoire.activite_faite bb
    where   aa.fiche_id = bb.fiche_id
    and     bb.fiche_id = aa.fiche_id
    AND     bb.activites_id = TO_NUMBER(:P23_ACTIVITES_ID)
    AND     TRUNC(aa.date_activite, 'YYYY') = TRUNC(TO_DATE(:P23_ANNEE, 'YYYY'), 'YYYY')And the second condition would be :
    Item not null :
    P23_ACTIVITES_IDHow to combine these two conditions into one display condition ?
    Thank you .
    Christian

    Hello,
    The issue is that you're doing -
    TO_NUMBER(:P23_ACTIVITES_ID)When you leave the Null return value blank like that, you'll typically see '%null%' used in session state (i.e. it's not actually null). Obviously '%null%' can't be converted to a number, hence the error you're seeing.
    A simple solution would be to make your null return value -1 or some other value that is guaranteed not to be a valid id (and alternative is to convert the %null% to a real null via an App/Page process etc (if you search this forum you'll find a few examples on how to do that). Another alternative is to use a DECODE to detect the '%null%' etc.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Primary key and relevant not null check constraints....

    Hi ,
    There are some constraints of primary key type and not null check constraints on columns which constitute each primary key....
    Should I/Do I have to drop them....????
    Do they burden the db at the time of data validation....????
    Thanks...
    Sim

    Hi,
    >>There are some constraints of primary key type and not null check constraints on columns which constitute each primary key..
    In fact, a column that constitutes a primary key, by default cannot accept NULL values. In this case, defines a PK column as NOT NULL would not be necessary.
    LEGATTI@ORACLE10> create table x (id number constraint pk_x primary key);
    Table created.
    LEGATTI@ORACLE10> desc x
    Name                  Null?    Type
    ID                    NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='X';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION                
    PK_X                           P X
    LEGATTI@ORACLE10> create table y (id number not null constraint pk_y primary key);
    Table created.
    LEGATTI@ORACLE10> desc y
    Name                  Null?    Type
    ID                   NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Y';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION
    SYS_C006327381 C Y "ID" IS NOT NULL 
    PK_Y                           P Y
    LEGATTI@ORACLE10> alter table y drop constraint SYS_C006327381;
    Table altered.
    LEGATTI@ORACLE10> desc y
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> insert into y values (NULL);
    insert into y values (NULL)
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("LEGATTI"."Y"."ID")
    LEGATTI@ORACLE10> insert into y values (1);
    1 row created.
    LEGATTI@ORACLE10> insert into y values (1);
    insert into y values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (LEGATTI.PK_Y) violated
    >>Should I/Do I have to drop them....????
    I don't see any problem, otherwise, drop the NOT NULL constraint is the same with alter the column table like below:
    LEGATTI@ORACLE10> create table z (id number not null constraint pk_z primary key);
    Table created.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    SYS_C006328420 C Z "ID" IS NOT NULL
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> alter table z modify id NULL;
    Table altered.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBERCheers
    Legatti

  • How To know Which Columns are not null and Which are null

    Hi Freinds,
    I want to Know ,How by Wrting a Query we can get the Names of The Columns from the Table which is set to not-null or null,
    Thanks
    Shoaib

    SELECT * FROM user_tab_columns
    WHERE table_name='Your_Table_Name'Check NULLABLE column.

Maybe you are looking for

  • MacBook Air will not boot to previous image

    I got a new MacBook Air for my company and used a prior image that has been used on previous model MacBook Pro's (Retina 15", 13", Air 2012, etc). When I apply the image, it does not boot. Is there any way I can get the dmg to boot on the new laptop

  • Spotlight serch not working properly

    Dear all.. I do not exactly know when this problem start, cuold be a cost of a server or client update. But suddenly the search with Spotlight from a OSX 10.5.8 on a 10.5.7 OSX Server does not find the file I am shure are in the server, in folder abv

  • Can bluetooth connect to 2 devices simultaneously? speakers & mouse

    I am planning to buy a bluetooth laptop mouse and also good room speakers that offer bluetooth connectivity (so that i can use my macbook as well as my iphone with them). Now, will my mouse and speakers connect to my macbook at the same time? Neerav

  • What the hell i can not download anything because of my adobe reader

    this is what it keeps showing me no matter what i download, what the hell is going on?(Adobe Reader could not open ').exe' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attac

  • [svn:bz-trunk] 21273: Fix an issue in MXMLServlet where we use context real path to locate sdk home .

    Revision: 21273 Revision: 21273 Author:   [email protected] Date:     2011-05-17 12:53:10 -0700 (Tue, 17 May 2011) Log Message: Fix an issue in MXMLServlet where we use context real path to locate sdk home. Modified Paths:     blazeds/trunk/qa/resour