SQL to do a similar comparison against two concatenated columns...

I'm doing a similar search against two columns that contain a first name, but people could touch as "John Doe"

Can I do a similar search against concatenated columns?

Kinda what I want to do...


Select * FROM worker_view WHERE
(LOWER (E.USUALFIRSTNAME) |) ' ' || Lower (E.LastName)) LIKE '% searchstring % '.


... but of course this isn't true... any direction would be appreciated!

Let's take your example as test case

First name: John
First name: Doe

Channel search possibilities:

'John'
'Doe'
'John Doe'
'Doe John'

SQL statement:

SELECT *
FROM   worker_view
WHERE  LOWER(E.USUALFIRSTNAME) LIKE LOWER('%searchstring%')
OR     LOWER(E.LASTNAME) LIKE LOWER('%searchstring%')
OR     LOWER(E.USUALFIRSTNAME) || ' ' || LOWER(E.LASTNAME) LOWER('%searchstring%')
OR     LOWER(E.LASTNAME) || ' ' || LOWER(E.USUALFIRSTNAME) LOWER('%searchstring%')

We'd still miss that follows:

'JohnDoe'
'DoeJohn'
'John  Doe'
'Doe  John'

Hope that should be fine with your application.

-dkv

Tags: Database

Similar Questions

  • Adding two analytical columns?

    Hi guys, another quick question. I have two analytical columns in my report. Is it possible to add up the total of these two columns?

    Thank you.

    Create a formula column

    and PL / formula SQL

    Add these two columns

    return: CS_COLUMN1 +: CS_COLUMN2;

  • How to calculate the time difference in the two date columns time.

    Hi Obiee Experts,

    I came back new requirement on obiee 10g.


    I have two date columns in my table time, data as below.

    StartDate: 18/03/2012-04:40:51

    Closing date: 18/03/2012-04:50:55

    I want to the output as below (Jet lag).

    output
    04:40:51 (less)-04:50:55 = 00:10:04

    I hope you understand my requirement in OBIEE.

    Note: I want to show above the output values in another State for OBIEE10g column.

    Please share me your valuable contributions. Urgent appeals.

    Thank you
    Satya

    Hi Satya,

    Here's another solution. You can try the formula below as it is:

    Cast (floor (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.))) SESS_BEG, '-SNP_SESSION '. SESS_END) / 3600) as char). ':' ||
    Cast (floor (mod (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.)))) SESS_BEG, '-SNP_SESSION '. ((SESS_END), 3600) / 60) as char). ':' ||
    Cast (mod (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.))) SESS_BEG, '-SNP_SESSION '. SESS_END), 60) as char)

    I would like to know if that's what you're looking for.

    Thank you

  • Add up the values from two numeric columns on RTF model

    Hello

    I'm trying to add up the values of the numeric column 2.

    I tried..? column_1 and column_2? > but it's not as simple as that obviously I get an error when you try to do

    I tried..? sum (current - group () / column_1) + sum (current - group () / column_2)? >, but who does no more work that it also returns an error


    Any ideas how to add two numeric columns in RTF model?

    for 2 + 3

     
    
  • the minimum value of two calculated columns column

    Hi all

    Please, help me in the following scenario.

    I have to get the data in two tables, so whatever the columns I need to put it in the select statement, but I have to do the calculations for two columns, and assigned an alias to these two calculated columns name, lets say X & Y.

    I need to show the data in column Z, the rule for this column must have a minimum value of columns X and Y.

    I have to use only a select statement and retrieve the data. Camnt make changes or creating features on the database.

    Thnaks in advance.

    Use a view inline and function LESS.

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/queries007.htm#SQLRF52357

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions087.htm#SQLRF00657

  • How to get the value of EV - the diiference between two different columns

    Hello
    I get the difference between the two different columns of two different... as tables (emp.sal - dept.comm)... all I want is I need only the records that a negative gap how get this? Please help me
    Thanks in advance

    If I understand your question right:

    select
      case when emp.sal-dept.comm>=0 then YOUR_VALUE
             else emp.sal-dept.comm
      end difference_value
    from emp,dept...
    

    or do you want to:

    select
      ...
    from emp,dept...
    where emp.sal-dept.comm<0
    

    ?

    Kind regards
    Sayan M.

    Published by: xtender on 19.11.2010 22:29

  • Compare two date columns

    Hello

    I want to compare two columns of dates in a table.

    Here, I wish to confirm that the two values are the same in each record.


    Hope that make sense



    See you soon

    Sexy

    Hi, Vanessa,.

    If d1 and d2 are the two DATE columns:

    SELECT     *     -- or list whatever columns you want to see
    FROM     table_x
    WHERE     d1 != d2
    ;
    

    Displays all the lines where they are declared, but not the same thing.

    If you want to include the lines where one of them is null, but the other is not:

    SELECT     *     -- or list whatever columsn\ you want to see
    FROM     table_x
    WHERE     LNNVL (d1 = d2)
    ;
    
  • How to create a table with two unique columns

    How to create a table with two unique columns. I use the following syntax below and I get the error message such unique or primary key already exists.

    create the table COPQ_WORKCELL_GOAL
    (
    Type_id varchar2 (4) NOT NULL UNIQUE,
    Tyle_Location varchar2 (30) NOT NULL UNIQUE,
    Type_Description varchar2 (20).
    KEY elementary SCHOOL (Type_id)
    );

    Use 1 or the other column type_id;

    create table COPQ_WORKCELL_GOAL
    (
      Type_id varchar2(4),
      Tyle_Location varchar2(30) NOT NULL UNIQUE,
      Type_Description varchar2(20),
      PRIMARY KEY (Type_id)
    );
    
    Table created
    drop table COPQ_WORKCELL_GOAL;
    
    Table dropped
    create table COPQ_WORKCELL_GOAL
    (
      Type_id varchar2(4) primary key,
      Tyle_Location varchar2(30) NOT NULL UNIQUE,
      Type_Description varchar2(20)
    );
    
    Table created
    
  • Comparison of two number

    1. I have ot make a VI for verification nuumber two if equal, greater or lesser.
    2 attached is VI.
    3. If the numbers are equal then print zero, if one is greater than 1, if its less print 2.
    4. I do not understand how to do it. When I put the output of three to digital output then its error, because we cannot do.

    Vindhyachal.Takniki wrote:

    @johnsold, how to do this. I have attached a VI. When a place a table it appears on the façade also, I did not play. On the front, there will be two number & an output.

    Build table allows you to create a table of Boolean in your results of the comparison, then Boolean table number to obtain a corresponding number.  You can then wire this result number in the selector of the case.

  • Comparison between two inputs

    Hello

    I am a beginner absolut for LabView and I learned LV tutorials, but I have a question and need your help.

    I have two digital inputs and one digital output and I want to output for example as many entries. What I need is how to compare two entry and decide for one of them.

    When I use a comparison operator as equal or smaller, I get a Boolean result but not a numeric. How can I use this to get for example the bigger or smaller?

    Thank you

    Oliver

    For example, you can use your superior decide who is actually higher then select this one through a structure of matter or a Select who will send you one to forward more great.

    That functionality is already attached to the Min/Max function, check it out.

    /Y

  • Comparison between two tables

    Hello

    I have two tables USERS and LISTS:

    And I want that there is a comparison between these two tables executed when user table USERS connect to the application.

    They must compare the columns between the SEXES and AGE and if some users have the same attributes in its ranks as in a line in the table LISTS (here is unique each line) so that the user gets in his line in the column 'LIST_ID' the ID of the line with which attributes between GENDER and AGE.

    Example:

    USERS TABLE: exampleuser | Boby | McGrahem | Male | 18. -------

    LISTS OF TABLE: 28 | examplelist | Male | 18

    Once the Login of the user Boby gets in its ranks the ID = 28 because the SEX and AGE corresponds to the row of table LIST:

    Result:

    USERS TABLE: exampleuser | Boby | McGrahem | Male | 18. 28

    
    CREATE TABLE  "USERS" 
       (    "USERNAME" VARCHAR2(15) NOT NULL ENABLE, 
            "FORRNAME" VARCHAR2(15) NOT NULL ENABLE,                  
            "SURNAME" VARCHAR2(15) NOT NULL ENABLE, 
            "GENDER" VARCHAR2(10) NOT NULL ENABLE,   
            "AGE" NUMBER, 
            "LIST_ID" NUMBER, 
             CONSTRAINT " USERS_PK" PRIMARY KEY ("USERNAME")
      USING INDEX  ENABLE
    
    

    CREATE TABLE  "LISTS" 
       (    " LIST_ID" NUMBER NOT NULL ENABLE, 
            " LISTNAME" VARCHAR2(50) NOT NULL ENABLE, 
            "GENDER" VARCHAR2(10) NOT NULL ENABLE, 
            "AGE" VARCHAR2(3) NOT NULL ENABLE,  
             CONSTRAINT " LISTS_PK" PRIMARY KEY ("LIST_ID")
      USING INDEX  ENABLE
       
    

    I need help for coding this, if someone be so good.

    This is my essay:


    DECLARE  
        v_listid varchar2(100);   
        BEGIN  
          
        SELECT  LIST_ID into v_listgid
         FROM LISTS
         WHERE GENDER = (SELECT GENDER
                              FROM USERS 
                            WHERE UPPER(TRIM(USERNAME)) = UPPER(TRIM(:APP_USER)))
         AND AGE = (SELECT AGE
                              FROM USERS  
                            WHERE UPPER(TRIM(USERNAME)) = UPPER(TRIM(:APP_USER)));
    
         UPDATE USERS   
        SET LIST_ID =  v_listid   WHERE UPPER(TRIM(USERNAME)) = UPPER(TRIM(:APP_USER));  
      
        END;
    

    I'd like to REALLY shy away using the USER name as the primary key, because the fact that users can create duplicate user names... YOU should NEVER base a PK on the entry of user, the better to let the database create and maintain this element of date...

    FIX:

    UPDATE to users U

    SET List_Id = (SELECT List_Id OF lists L WHERE L.Gender = U.Gender and L.SOMENUMBER = U.SOMENUMBER) AND

    Upper (U.UserName) = UPPER(:APP_USER);

    Don't really want to cut the strings, Oracle which will do since they are of type varchar2 columns...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Comparison of two values Datetime, but only the part of everyone's schedule

    Hello. I have two Datetime objects on my form. Both are formatted and only display the HH:MIPM. I have a validation requirement where I have to check if: TimeA is higher (: TimeB - 30 minutes). What would be the best way to build an IF condition allows to assess both these Datetime variables and determines if the time portion to: TimeA is greater than the time portion of: TimeB - 30 minutes? The part 'date' Datetime value should not be taken into account in the comparison.

    Any help would be greatly appreciated.

    Published by: Buechler on April 13, 2010 10:43

    If you really want to ignore the date and to assess the time, I would like to convert it each date to CHAR formatted as time column and convert it back dated to essentially match the date part. You can then perform a calculation of standard date to get the time difference and check if the difference is more than 30 minutes. For example:

    DECLARE
       TIME_B  DATE := To_Date(To_Char(:DATA_BLOCK.TIME_B,'HH24:MI:SS'),'HH24:MI:SS');
       TIME_A  DATE := To_Date(To_Char(:DATA_BLOCK.TIME_A,'HH24:MI:SS'),'HH24:MI:SS');
    BEGIN
       IF ( ABS(TIME_B  - TIME_A) > .021 ) THEN
          /* If you divide 30/1440 you get the numeric equivilent of 30 minutes. (.021) */
          -- Differnece is greater than 30 minutes!
          -- Do Something Here....
       ELSE
          -- Difference is LESS than 30 minutes!
          -- Do Something here....
       END IF;
    END;
    

    I hope this helps.
    Craig...

  • Value of aggrigate of procedure - Get Oracle on the comparison of two-column based

    Hi all
    I've written a procedure that accepts an input parameter and returns a refcursor.
    The logic used in the procedure is:
    The procedure is used to display the summary and the report in detail. When the input parameter has more than one saperated comma then it will act as a synthesis report, and when there is just a value as input, then it will act like a detailed report.
    The input parameter is as "AA12345, BB45434, HJ89736," the first two characters is Brand_id and the rest of the 5 character is the propery_id.
    The aggrigation of aggrigation query is:
    Select Month_name, Year, sum (REVPAR), Sum (ADR) in the FIS_KPI_TREND where
    Brand_id = 'AA' and SIte_id = '12345' Month_name group, year;
    The above query will worke fine for detail report when there is just a value for the entry as 'AA12345 '.

    The problem is coming to the summary report when I need to get the value of aggrigated for all the brand and the site which is entered in the input parameter.
    So I changed the query in the form:
    Select Month_name, Year, sum (REVPAR), Sum (ADR) in the FIS_KPI_TREND where
    Brand_id | SIte_id in ('AA12345', 'BB45434', 'HJ89736') of the Group of Month_name, year;
    (I use parser function to parse a comma saperated values.)

    By doing this, I get the desired result, but the performance has decrised that the Index is based on Brand_id and Site_id but I'm using Brand_ID | Site_id for my research.

    The one you suggest another way to rewrite this query so that it can take the index and not give me the output of sesired.

    Database used: Oracle 10 g

    Thanks in advance.
    Sumit Narayan

    Published by: Sumit Narayan, 11 April 2010 22:00

    I'd be inclined to do something like that to analyze the list separated by commas, that allows you to join without the concatenation of the columns as you do now.

    ME_XE?select
      substr(column_value, 1, 2)            as brand_id,
      substr(column_value, 3, length(column_value))   as site_id
    from table(sys.ODCIVARCHAR2LIST('AA12345','BB45434','HJ89736'));
      2    3    4
    BRAND_ID   SITE_ID
    ---------- ----------
    AA         12345
    BB         45434
    HJ         89736
    
    3 rows selected.
    
    Elapsed: 00:00:00.20
    ME_XE?
    
    ME_XE?select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE  10.2.0.1.0  Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    5 rows selected.
    
    Elapsed: 00:00:00.39
    ME_XE?
    

    So for your case...

    Select
      f.Month_name,
      f.Year,
      sum(f.REVPAR),
      Sum(f.ADR)
    from FIS_KPI_TREND f, table(sys.ODCIVARCHAR2LIST('AA12345','BB45434','HJ89736')) t
    where f.Brand_id = t.brand_id
    and   f.SIte_id  = t.site_id
    group by f.Month_name, f.Year;
    

    Published by: Tubby 11 April 2010 22:12

  • No sequences present in the comparison of two models of auto-increment columns and triggers

    Hi, I'm using Oracle SQL Developer Data Modeler version 4.0.3 and I get the same behavior described in the discussion 9876135.

    Y at - it an update on this issue?

    Thank you

    Hello

    No DOF preview is currently generated differences in properties on the auto-increment columns properties page.

    However, if you create a sequence with the relevant name (and the user as appropriate) in your physical model Oracle, then its properties will be used instead of the ones on the page Auto Increment, and in this case the DOF preview will include the DDL for changes in its properties, e.g.

    FALL OF SEQUENCE "TABLE_1_SEQ".

    ;

    CREATE SEQUENCES "TABLE_1_SEQ."

    START WITH 5

    INCREMENT OF 10

    ;

    If only the increment "by" is changed, an ALTER SEQUENCE will be generated:

    CHANGE THE SEQUENCE "TABLE_1_SEQ".

    INCREMENT OF 10

    ;

    David

  • Comparison of two documents

    I compare two documents and I can see the differences, but there is a progress screen that stays on top and doesn't seem to end. Any ideas?

    Use of Adobe Acrobat Pro 8.1 Windows DC

    Compare pdf.JPG

    My solution has been to save the file and open it again.

Maybe you are looking for

  • How to reinstall Tecra S3?

    Good day to you all. I'm trying to reinstall the laptop of my father. It has a Tecra S3. But when I try to reinstall I get the following error: windows does not see your hard drive, the computer will reboot in 15 seconds. Does anyone know what exactl

  • How to get wifi connection after reinstalling factory default DVD for Iconia W3-810?

    My W3-810 Iconia has been reset using Acer Recovery DVD. After that 8 window has been restarted, he not been able to find the wireless device. Does anyone know how to get a wifi connection after reinstalling factory default DVD?

  • Wallpaper - how to use a HTML document as a background in Windows 7?

    Original title: wallpaper In Windows XP, I've been able to use a htmp (Web page) document that I wrote as my desktop wallpaper, this contained the text and gif. However in Windows 7 I only seem to be able to use photos or slideshows.  Anyone got any

  • Increase the disk space

    My C drive has 5% free space. and my drive D "New Volume" 93% of free space. When I right click on drive C 'Player Extend' option is not usable. How can I increase the capacity of the C drive? I tried shrinking the D drive, thinking it would give me

  • Hard drive Windows 7 to transfer to the new motherboard without reinstalling

    Hey all - So, my goal is to transfer my old hard drive to a new motherboard without reinstalling my OS. I heard that it is possible, but difficult. If I find it's too intimidating, anyone know how I can do to reinstall my windows 7 if I don't have an