No comparison Condition

In the following statement why not use terms such as 'Like' or 'In' instead of 'Not '.  Honestly I skipped this part of my reading I understood implicitly given logic, I've been doing SQL for a bit, but do not include it in explicit terms.

Thank you.

SELECT EMPLOYE_ID, LAST_NAME, FIRST_NAME

EMPLOYEES

WHERE SHIP_ID = 1

AND NOT (LAST_NAME = 'Smith' AND name = 'Al');

What do you think of what it would say if you put

AND LIKE (LAST_NAME = 'Smith' AND name = 'Al')

other than making your SQL looks like a Valley girl?

Tags: Database

Similar Questions

  • Problem of numerical comparison conditional Action

    I read the long blog of Rod Ward on conditional actions in Captivate, which seems to tell me if I have a user with a numeric variable and I'm comparing it with a literal value of-1 to see if they are equal, it should work fine because, as Rod, says "what is happening under the hood is that strings are first converted to digital before be assessed values.  However, it clearly doesn't.  That's what I have for the IF condition: VariableName is equal to-1.  The value of the variable declared in the Console (via a call to cpAPIInterface.getVariableValue ()) is - 1.  And yet the conditional action performs the ELSE action instead of the action of the YEW, as if he thinks that the variable, the value is - 1 is NOT equal to-1.  Captivate is certainly not lame that it can't handle the sign less on the - 1!  Anyone has an idea why it wouldn't work?

    I was waiting a bit to see if any of the other advanced/prolific contributors would be consistent with an opinion opposite to one Lilybiri expressed, but no one has.  I appreciate the offer of Lilybiri for help .  For awhile, I thought his assertion that Captivate couldn't handle

    If varname is equal to-1

    correctly.  I created a test case very simple to try to confirm, one who had nothing else going on at all to blur the.  I was surprised when it worked very well comparing a variable with-1.  Then I noticed other places in our advancement of existing shares that already rely on it working properly, and they worked as expected.  So I was banging my head against it to try to understand the real reason for a few hours it did not work and then I discovered there are TWO assets, click boxes on this slide, which enabled the AA I had been struggling with and another who had not changed but should be doing the same action as the ELSE the other action.  So basically, I discovered it wasn't a problem with the check against-1, such that it was originally, but execution of the evil AA.

    In addition, if Rod blog comment is correct ("what's happening under the hood is that strings are first converted into digital values before being evaluated"), it SHOULD work perfectly to compare negative numbers.  And it looks good now.

  • How to get several beep?

    Hello

    I want to get several beeps output if a comparison condition gives output as true.

    Can someone tell me how to get several beep?

    Put the beep function in a loop with a small wait for the statement.

  • read the values of an array element and by sending a digital output to a designated channel according to the value read from the table

    Hello world

    could someone help me before I get out of my hair. Here's my problem.

    I read 3 values of an array of 3 elements i.e. 1,2,3. These values are then compared to a constant value, example if the first element of the array is 1 and it meets the comparison condition can send a digital camera of output for that channel on data acquisition

    I want to be able to send a value from a table to its corresponding comparison and then on its designated channel on the acquisition of data, the whole point of this is due to the fact the table element will not always read the value 1,2,3 for example could be 2,3,1

    Here's one the vi I have so far

    If someone could help it would be much appreciated

    all the best

    brand

    Take time to explore the many examples included with LabVIEW that cover the basics.

    -Indexing table

    -reading a spreadsheet file

  • T/t with the WHERE clause using a list breaks

    Hello, all,.

    I have a project where I need to use a list as part of the WHERE clause for a t/t, and it is breaking.  I don't know what I'm doing wrong.

    For some pseudo-code, do I have a complete query of a database called 'people '.  A list of values for the t/t with the first query; the second query is my t/t:

    <cfquery name="getDIR" datasource="#request.THISDSN#">
        SELECT thisName dir FROM orgs WHERE thisID in (<cfqueryparam value="#form.org#" cfsqltype="cf_sql_varchar" list="yes" />)
    </cfquery>
    
    <cfquery name="people" database="people">
        SELECT colA, colB, colC, colD
        FROM people
        WHERE 1=1
            AND (
                div IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />)
                OR dir IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />)
                )
    </cfquery>
    
    
    

    I get the error message is "t/t syntax error: encountered" div IN \'thisValue\' ".»  Incorrect conditional expression, waiting for one of [as | null | between | in | comparison] condition. »

    Can support _not_ QoQ lists of WHERE clauses?

    V/r,

    ^_^

    SMH - so much... I just found.

    I forgot to give the lists in the second query bracket.


    (The pseudocode was manually typed, since my dev system is isolated from the internet, and I added the in my pseudo code when they were not in my original code.)

    * headdesk * headdesk * headdesk * headdesk *.

    V/r,

    ^_^

  • Using NVL in the query in the query resulting in error

    I always use CF8 and Oracle 11 G back.

    When I use NVL in the query in the query, I got error... I can't use NVL to check the value null? Help, please

    Here are my codes:

    < name cfquery = "GetC2" datasource = "#Trim (application." OracDSN) #">"

    SELECT CamID2, rel2_2, p_ln2, p_fn2, ins, l_year

    OF prt_temp

    WHERE Ins = 'CC '.

    AND l_year = '1481'

    AND NVL (Child_LN2,' ') <>' '
    AND NVL (Child_FN2,' ') <>' '

    < / cfquery >

    < cfif GetC2.Recordcount NEQ 0 >
    < cfquery name = "CheckRel2C2", dbtype = "QUERY" >
    SELECT CamID2, rel2_2
    OF GetC2
    WHERE NVL (Rel2_2,' ') <>' '
    AND NVL (p_ln2,' ') = ' '
    AND NVL (p_fn2,' ') = ' '
    AND Ins = 'CC '.
    AND l_year = '1481'
    < / cfquery >

    < / cfif >

    The error:

    Run database query error.

    Query of queries syntax error.

    Met «NVL (Rel2_2.» Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition,.

    NVL is an Oracle function and it is not available in ColdFusion query of query.  If you try to check the values null, use IS NULL or IS NOT NULL.  Then

    WHERE NVL (Rel2_2,' ') <> ' '

    AND NVL (p_ln2,' ') = ' '

    AND NVL (p_fn2,' ') = ' '

    becomes

    WHERE Rel2_2 IS NOT NULL

    AND p_ln2 IS NULL

    AND p_fn2 IS NULL

    -Carl V.

  • How can I extract a substring in WHERE Clause &lt; CFQUERY &gt;?

    Is it possible to extract a substring in the WHERE clause of either < CFQUERY > or in a query of queries?  I try to use the following query to find all e-mail addresses with the domain "comcast.net" (i.e., everything that follows the '@' in the email address).  I ask an MS-Access database table.

    < cfquery name='test' datasource='membership'>
    SELECT Email_address
    OF tblMembers
    WHERE the MID (email_address, INSTR (email_address, ' @') + 1) = "comcast.net"
    < / cfquery >


    If I try this as a query, I get the error message "[Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] data type incompatible in criteria expression."


    If I try it as a t/t, I get the error message " " Met 'MID (e-mail1.,. Incorrect conditional expression, waiting for one of [as | null | between | in | comparison] condition,'.

    I would be very grateful for any help on finding something that works!  Thanks for your help!


    You couldn't do a LIKE in where clause instead:

    SELECT Email_address

    OF tblMembers

    WHERE email_address LIKE ' %@comcast.net'

    You should get the addresses you're looking for.

    -Carl V.

  • Query of queries: error when you try to fake Left Outer Join

    Hello

    I'm trying to reproduce a left outer join, combining two query of queries using a method I find here

    However, I get an error message...

    Here is the code I use...

    < cfquery dbtype = "query" name = "qry" >
    SELECT *.
    OF returnQry, returnQry2
    WHERE returnQry.mediumImage = returnQry2.mediumImage
    ORDER BY returnQry.name
    < / cfquery >

    < name cfquery = "returnQry3", dbtype = "#application.mx #" >
    SELECT *.
    OF trackmeanings t
    < / cfquery >

    < cfquery dbtype = "query" name = "endQry" >
    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE qry.name = returnQry3.sNameTrack

    UNION

    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE #qry.name # NOT IN (#QuotedValueList (returnQry3.sNameTrack) #)
    GROUP BY name, nameRcd, mediumImage
    < / cfquery >

    When I try to use the query output in a page, I get the error message "incorrect conditional expression, waiting for an a [as |]» null | between | in | "comparison condition.

    Anyone have any ideas?

    Thank you very much

    The items in the list should be cited.  Since you are using quotedvaluelist, it's weird that they aren't.  However, if you use cfqueryparam, list = Yes, you should have better luck.  Among other things, it will protect you against the apostrophe in names.

  • Query question queries

    You can query a query created using queryNew()?

    When I try the following code, I get an error:

    "Query of queries syntax error.
    Meeting "qData. user. "Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition."

    Code:

    < cfset qData = queryNew ("tool, user, community, fm01, fm02, fm03, fm04, fm05, fm06, fm07, fm08, fm09, fm10, fm11, fm12, fy") >
    < cfset temp = #queryAddRow (qData) # >
    < cfset temp = #querysetCell (qData, "tool", "empty") # >
    < cfset temp = #querysetCell (qData, "user", "Bob") # >

    < cfquery dbtype = "query" name = "chkQdata" >
    SELECT *.
    OF qData
    WHERE qData.user = 'Bob '.
    < / cfquery >

    I just tried the code you provided, adding two cfdump Tags (the first to empty the qData query and the second to empty the chkQdata query). Everything worked well exactly as you had it on Railo 3.1. It did not work (threw the error you got) on CF 8.0.1.

    If I deleted the WHERE clause of the query of chkQdata, it runs (no error) in CF 8.0.1.

    For that it works as you want in CF8, change the user column. This seems to be a keyword for CF8. While I didn't check exactly, if I change your original request to be 'empty' = tool, it runs. In addition, rename the column user usr generates the script runs correctly.

    Here is the code that I had to work in CF8 and Railo 3.1:

    SELECT *.

    OF qData

    WHERE the usr = "Bob."

  • Timed condition (comparison timed)

    Hello, just wanted to ask a simple way to make a timed condition.  To be brief, I have a value which I want it to be greater than zero for 'x' seconds.  If this value is greater than zero for the seconds 'x', a 'real' Boolean value would turn an led on.  However, if during these 'x' seconds, the value is equal to or less than zero, even for one second, then the light should stay off or its value "false".

    Is there a simple way to make a timed comparison?  Thanks a lot for reading and post your suggestions.

    Best,

    Nestor

    Nestor,

    Set all the values acquired during the seconds 'x' in a table. Use the Array Min Max function.  If min< 0,="" then="">

    Lynn

  • comparisons of condition

    I worked on the filter conditions, and got a specific requirement to exclude 'Y' in the column rewritten and retrieve all results excluding the 'Y '.

    Let's say I have 5 rows, column rewritten a 2 nulls, 2 "Y" and "n-1".

    I added the filter-

    rewritten! = « Y »

    I had 1 sheet with N in the column rewritten. I would include NULL values in the results.

    I watched this kind of comparison of condition-

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/sql_elements005.htm

    Looks like she'll return unknown = won't return any record with the value null.

    I was wondering not to do. I tried to use DECODE to get null to changed to «» Has not worked for me.

    I have a way to work around this problem by using the programming language, I understand this situation.

    Thank you in advance if someone replies to this topic.

    Hello (and welcome).

    You will need answer here NULL values, since they are the lack of a value, they will return either true or false.

    Therefore, instead of:

    rewritten != 'Y'
    

    Try:

    NVL(rewritten,'X') != 'Y'
    
  • Comparison of the conditional formatting to another column

    All,

    I wonder if there is a way to compare to another column in the comparison of the conditional formatting? I have two columns, one which is the original value and another which is a return entry that starts with the original value, then changes. Is it possible to compare the two in the conditional formatting, and then say so bold or in italics the original version back writing change? I tried to use SQL and the format of the column as it is on the report and it does not accept whatever it is, it says that "the value entered is not valid."

    Thanks in advance,

    Josh

    Why not add a column that performs the comparison, hide this column and to sit the formatting of the column (you want to format) on the value of the hidden column?

    Kind regards
    Stijn

  • conditional error for comparison of sine waves

    Hi all

    I do a small program concerning some changes in the sine waves, and later I compare to set my status. I can't get through this error. I really want to put out as Boolean so my loop condition is attached to this release. Everyone please help

    Concerning

    Qasim

    It's called Convert Dynamic Data type and on the Express > range of Manipulation of the Signal. When you drop on the diagram to a dialog box can be displayed and giving you options regarding the type of data.

    Lynn

  • Find entries with several conditions, including the comparison

    Hello

    I take the edition of I v6.2.7 a ride, I'm looking at the use case is the following. I have a "table" with about 100 k records defined by this object:

    @Entity
    public class LTROW {
    
      @PrimaryKey
        private Integer id = null;
    
        @SecondaryKey(relate=Relationship.MANY_TO_ONE)
        private Integer tableId = null;
        
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
      private String col0 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col1 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col2 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col3 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col4 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col5 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col6 = null;
        @SecondaryKey(relate = Relationship.MANY_TO_ONE)
        private String col7 = null;
        
        private String result0 = null;
        private String result1 = null;
        private String result2 = null;
        private String result3 = null;
        private String result4 = null;
    // ...
    }
    

    Typical research I must apply is: give me all the entries contained in tableId X where the value of co0 is equal to 7, 1112 exceeds the value of col1 and col2 value is less than 8.

    I got in the definition of index for all columns defined in the class, but can't seem to understand how to combine these criteria. I looked at EntityJoin but it doesn't seem to be what I'm looking for.

    Thank you!

    You cannot use multiple indexes for this kind of query. Instead, create and use a single index for one of the conditions and filter on other conditions. I hear, by 'filter' select the records you want using an 'if' statement Try to choose the index that returns the smallest number of records.

    See:

    http://www.Oracle.com/technetwork/database/database-technologies/BerkeleyDB/performing.PDF

    -mark

  • Under certain conditions, update a table based on the comparison with a SQL statement

    I have a table (table 1) that has 4 columns:

    UID. THE NEST | VALUE1 | VALUE2

    I have another statement SQL (STMT) that returns the 3 columns of a few other tables:

    UID. THE NEST | VALUE1

    Now this is the condition of the way in which I want to put up-to-date TABLE1:

    First, to compare a pair of UID and PID of STMT with those in TABLE1,

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    I can't seem to come with a solution for condition 2. Any help is appreciated!

    Hello

    Here's one way:

    MERGE INTO  table1  dst
    USING          (
                 SELECT  ...   -- your stmt query goes here
             )   src
    ON         (    src.uid  = dst.uid
             AND      src.pid  = dst.pid
             )
    WHEN MATCHED THEN UPDATE
    SET           dst.value1 = CASE
                                   WHEN   dst.value2 > 0
                        OR     (   dst.value2 = 0
                             AND dst.calue1 != src.value1
                        )
                        THEN   src.value1
                               END
    WHERE   dst.value2 > 0
    OR (    dst.value2 = 0
       AND  dst.calue1 != src.value1
       )
    ;
    

    This assumes that the combination (uid, pid) is unique in stmt. It doesn't have to be unique in table1.

    sb92075 wrote:

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    FUSION could also do parts 1 and 2 together, in the same statement.

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    Why are they not simply your needs ' uid and pid that already exist in stmt and table1, if table1.value2 > = 0, then the value table1.value1 = stmt.value1 "? Are you concerned about shooting triggers unnecessarily? It has something to do with null values? The MERGE statement above does exactly what you asked, but, depending on your needs, something simpler and more efficient could do it as well.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

    Published by: Frank Kulash, June 6, 2012 14:51

Maybe you are looking for