To search in multiple columns

Hello

I have a table of the CITY with the columns ID, NAME, DESCRIPTION and I have another table with the columns ID, FIRST_NAME, LAST_NAME, CITY_ID and me have the CITIZEN Table View that represents the columns CITY.NAME, PERSON. First name per PERSON. LAST_NAME.

The customer is able to enter several words iin an inputText field and then click on the search button. A search query might look like this: Springfield + Simpson.

My query is supposed to do the following scenario. Research in PERSON. First name to Springfield and Simpson, pick up in PERSON. Last_name for Springfield and Simpson, research CITY.NAME of Springfield and Simpson, and research in the CITY. DESCRIPTION of Springfield and Simpson. The query must return all CITIZENS which contain the words from 2 to 4 columns.

I tried to create an index und using the sql - clause, but this did not bring me anywhere.

Anyone have an idea on how to do it?

Thank you
Tobias

I tried to create an index und using the sql - clause, but this did not bring me anywhere.

What have you tried so far in this regard?

You should probably ike into something like

var your_string varchar2(1000)

exec :your_string := replace('Springfield + Simpson','+', ' and ')

select *
  from person
 where contains (first_name, :your_string) > 1
    or contains (last_name, :your_string) > 1
union all
select *
  from city
 where contains (name, :your_string) > 1
    or contains (description, :your_string) > 1
/

Tags: Database

Similar Questions

  • Gears - error when you try to insert values into a table with multiple columns

    Hello

    I started playing with the gears and SQlLite today and I get an error when I try to insert values into a table with multiple columns.

    I have:

    var db = google.gears.factory.create('beta.database');
        db.open('developerSet');
        db.execute('create table if not exists Developers (DeveloperName text, DeveloperAge int)');
    
        var devName = "Davy"
        var devAge = 32;
    
        try {
            db.execute('insert into Developers values (?, ?)', [devName, devAge]);
            alert('success');
        }
        catch (e) {
            alert(e);
        }
    

    I get the error:

    net.rim.device.api.database.DatabaseException; insert into developers values (?,?): SQL logic error or missing database.

    I use this reference: http://code.google.com/apis/gears/api_database.html

    Everything works if I have only one field as:

    var db = google.gears.factory.create('beta.database');
        db.open('developerSet');
        db.execute('create table if not exists Developers (DeveloperName text)');
    
        var devName = "Davy"
        var devAge = 32;
    
        try {
            db.execute('insert into Developers values (?)', [devName]);
            alert('success');
        }
        catch (e) {
            alert(e);
        }
    

    I use the plug-in Visual Studio 2.0 for 2008 that are running Windows XP SP and Simulator 2.13.0.56

    Thank you

    Davy

    Yes, a SQLite database will persist between battery pulls.  The database is registered either to internal MEM or removable media (not the device memory), depending on which is available on your device.

    In general, its not considered a best practice to remove your table as soon as it is empty and re - create it again when you want to add data.  This adds extra overhead fresh for the final, delete and insert first for a given table.  Instead, define and finalize your drawing before you create your table.  Once created, review the static schema.

    That being said, for development purposes, it may be easier to provide an easy way to drop your tables while you develop your schema.

    See you soon,.

    Adam

  • Update multiple columns from multiple tables in a single UPDATE request

    Hello

    I'm trying to figure if I'm heading in the right direction.

    I want to update multiple columns from multiple tables in a single UPDATE request. Also, I would like to update multiple columns in a table from the tables.

    Scenario 1

    UPDATE Table2, Table 3
    SET T2.Column1 = T1.Column1 
    ,T2.Column2 = T1.Column2
    ,T3.Column2 = T1.Column2
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T1.id = T2.id
    and T1.id = T3.id
    
    

    Scenario 2

    UPDATE Table3
    SET T3.Column1 = T1.Column1 
    T3.Column2 = T1.Column2
    ,T3.Column3 = T2.Column3
    ,T3.Column4 = T2.Column4
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T3.id = T1.id
    and T3.id = T2.id
    
    

    Hello

    For scenario 1, you must write separate instructions UPDATE table2 and table3.

    To guard against someone else change one of these tables while you act so you can copy all relevant data in a global temporary table and update this global temporary table table3.

    ENGAGE only when two tables have been changed.

    You can write a procedure or an INSTEAD OF trigger to do all this.

    For scenario 2, you can reference many tables that you need when new table3.  It might be more efficient and simpler to use the MERGER rather than UPDATED.  For example:

    MERGE INTO table3 dst

    WITH THE HELP OF)

    SELECT t1.id

    t1.column1

    t1.column2

    t2.column3

    t2.column4

    FROM table1 t1

    JOIN table2 t2 ON t1.id = t2.id

    )             src

    WE (dst.id = src_id

    WHEN MATCHED THEN UPDATE

    SET dst.column1 = src.column1

    dst.column2 = src.column2,

    dst.column3 = src.column3,

    dst.column4 = src.column4,

    ;

  • Make multiple columns while placing text in InDesign CC 2015

    I used to be able to drag all by placing a text file and press the right arrow key before releasing the mouse to create multiple columns within a text. Which seems more to work in InDesign CC 2015.

    Is this a bug or Adobe changed the way it works?

    I just tested in CC 2015 and CS6.

    What works is when you slide on a block of empty text with the text tool, by pressing the right arrow key divides the image into two columns. (This works also when creating other images).

    In both versions of InDesign, when you place a text file or Word, this shortcut does not work.

    We must therefore create first part of two columns of text, then place the text in the frame.

  • How can I create sequential shooting (1 for each 'row') numbers in a script in multiple column?

    How can I create sequential shooting (1 for each 'row') numbers in a script in multiple column?

    Sorry, but for now there no such function to put sequential numbers in the column number drawn.

  • How do you count multiple columns of a field in a table

    How do you count multiple columns of a field in a table

    Select count (*)

    of user_tab_columns

    where table_name = 'YOUR_TABLE '.

  • Struggling to search for multiple files

    Hello

    I'm fighting to search / select multiple files.

    This is my workflow:

    I have 2 computers, one is used for all image manipulations using a combination of LR & PS and the other computer is used for the sales presentation using ProSelect.

    Once I'm done with my post production I export images to my computer for presentation for sale to the JPG file format.

    After the sale I want to then be able to star the images that they have purchased on my computer to post production. Currently I did this manually, even if time can not too bad when you're talking about only 20 images. However, this does not work for weddings by looking at images of 150-200.

    That's what I tried. I made an export of the names of files in ProSelect. I then removed the suffix .jpg for example. In Lightroom, I the filter bar, text, select all text, Contains searchabe and then paste it into the list of file names. After a while, he'll come back and say no images found or it may come with only the 1st image in the list. I tried several combinations of formatting of the list of file names and none seem to work spaces, commas, semicolons, each file name in «»

    If anyone can help me in this regard, I would be very grateful.

    Thank you

    Tony

    The list of files must be separated by spaces or commas - you copy and paste from a list in which they are separated by line breaks.  I have tried in my own 5.6 LR (Mac), and when the file names are separated by spaces, it works, but not when separated by line breaks.

  • Concatenate multiple columns in a single string

    Hello

    I use Oracle 11.2, how can I concatenate values from multiple columns in a string with an SQL:

    create table testTb (number (5) classId, class varchar2 (32));

    Insert into the testTb value (101, 'room101');
    Insert into the testTb value (101, 'room201');
    Insert into the testTb value (101, 'room301');
    Insert into the testTb value (202, 'room444');
    Insert into the testTb value (202, 'room555');

    I would like to generate the result as following:

    Class 101 is room101, room201, room301
    202 class is located in room444, room555

    Thank you

    Please post sample data.
    11.2 you can use LISTAGG:

    SQL> select 'Class '||classid||' is in '||listagg(classroom, ', ') within group (order by classroom)
     str
      2  from   testtb
      3  group by classid;
    
    STR
    --------------------------------------------------------------------------------
    Class 101 is in room101, room201, room301
    Class 202 is in room444, room555
    
    2 rows selected.
    
    SQL> 
    
  • to display the separted by commas in multiple columns

    Hello


    I want to display the value in multiple columns like below

    data like this

    col1

    res_menaHome:MenaHome
    res_menaHomeEmp:MenaHome used
    res_MDSpecialSer:MD Special Services
    res_Smart: Smart

    now, I want to display like

    col1 col2
    res_menaHome MenaHome
    res_menaHomeEmp employee MenaHome
    res_MDSpecialSer® Special Services
    chip res_Smart


    Thanks in advance.

    You mean like this?

    with q as (select 'res_menaHome:MenaHome' myString from dual)
    select substr(myString, 1, instr(myString, ':') - 1) col1,
    substr(myString, instr(myString, ':') + 1) col2
     from q
    
    COL1,COL2
    res_menaHome,MenaHome
    
  • Call a select stmt with multiple columns inside another column

    Hi all

    I have a question about the appeal of a select statement, which is to have multiple columns inside another select statement.

    I know that we can use inline views to retrieve data from another table within a query as shown below.

    SELECT (SELECT dname FROM dept WHERE deptno = e.deptno), deptno, sal FROM emp e;

    Now, I'm going to pull the loc also column within the same view of inline. But oracle is not allowing me to do the same thing.

    Is there a way we can achieve the same thing because I don't want to hit the area two times table each time for each emp record.

    Appreciate your valuable suggestions.

    Thank you
    Madhu K.

    Maybe just a simple outer join?

    select ut.subscriberid
          ,ut.unitid
          ,ut.install_date
          ,nvl(tuh.hardwaretype, 'NO_HW')
    from   tt_unit ut
    left   join tt_unit_hwtype tuh
    on     tuh.unitid = ut.unitid
    where  trunc(ut.install_date) >= V_CONST_PROG_START_DT;
    
  • Search for a column

    Hi all

    I have about 50 tables in a schema ABC

    I am looking for a column of perticualar like XYZ

    As my tables contain huge data, is it possible to search this perticualr column

    can someone sugest me please.

    Thank you

    Hello

    To find the tables in the schema of the CBA who have a column named XYZ:

    SELECT  table_name
    FROM    all_tab_columns
    WHERE   owner        = 'ABC'     -- Case sensitive!
    AND     column_name  = 'XYZ'     -- Case sensitive!
    ;
    

    Published by: Frank Kulash, November 18, 2011 17:20

  • CSS3 multiple columns and Internet Exploder

    I have developed a web page that needs a two column layout and has decided to use CSS3 to describe the columns: very simple:

    {.twocol}

    border-style: solid;

    border width: 7px;

    border-color: #0476ac;

    -webkit-border-radius: 20px;

    -moz-border-radius: 20px;

    border-radius: 20px;

    -moz-column-count: 2;

    -moz-column-gap: 20px;

    -webkit-column-count: 2;

    -webkit-column-gap: 20px;

    number of columns: 2;

    column interval: 20px;

    padding: 10px;

    height: 300px;

    }

    CSS bold described the two-column layout that I want.

    Looked in Internet Exploiter version 9 and it failed. And, since the text was missing I did the 'old skool' method:

    {.colLeft}

    Width: 410px;

    }

    {.colRight}

    Width: 410px;

    float: right;

    }

    Then in HTML:

    < section class = "twocol" >

    < div class = "colRight" >

    < p > right column of things comes here < /p >

    < / div >

    < div class = "colLeft" >

    Insert here the stuff left column < p > < /p >

    < / div >

    < / section >

    I have commented things in "BOLD" in my style sheet.

    Here's my question:

    Since I'm on the HTML5 Shiv, shouldn't that have created the support for multiple columns in CSS3 declarations or is it simply too complex?

    HTML5 Shiv, as its name suggests, is strictly for the support of HTML5 tags in pre - IE9.  It will not help you with CSS level 3.

    Nancy O.

  • GROUP BY with multiple columns.

    I have a little query on the GROUP BY clause.

    Sometimes, we will give several names of columns in GROUP BY. If it behaves in the same way as ORDER BY (multi-column) I wish I had an example where I can use GROUP BY multiple columns. in any case regardless of his behaviour, it will be really appreciated if someone can explain a scenario where GROUP BY with multiple columns can be used.

    I know about the use of GROUP BY aggregate functions, but using a single column.

    Thank you.. !!!

    No, not like that

    I think that Group by does not follow any order...

    If we execute like this

    SELECT registrationid, dateofbirth, sum (age) FROM prawin62 WHERE registrationid = 22 GROUP BY dateofbirth, registrationid.

    22     1/23/1975     54
    22     5/18/2011     330
    

    It will give the same result based on date of birth...

    ~ Praveen

  • Search the text column in the table dba_views

    Hello
    Could someone tell me please how to write a query to determine if certain words exist in the text of the dictionary dba_views table column? The data type of the column of text at LENGTH, so a simple query like the one below doesn't work.

    Select view_name
    from dba_views
    where the text like 'ABC % '.
    or text like '% DEF % '.
    or text like 'GHI % % '.

    Hello

    See this example

    Search text in column

  • Sort order incorrect in datagrid sort multiple columns

    Hello

    I'm a little confused about sort multiple columns in a datagrid. The following code sorts, but not the sort, I expect or what you are doing the thing about a coming O alphabetically before or after P. In my opinion, the code must sort stadt, vname by clicking on the city column, and name, the VNAME by clicking on the column name, but obviously he disobeys correctly? You see an error in the code or is this a bug?

    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "vertical" >
    < mx:Script >
    <! [CDATA]
    Import mx.collections.SortField;
    Import mx.collections.Sort;
    Import mx.collections.ArrayCollection;
    Import mx.events.DataGridEvent;
    var myData: ArrayCollection collection = new ArrayCollection (new Array () collection
    {name: "Meier", vname: "Peter", City: "Bonn"},
    {name: "Meier", vname: "Max", City: "Bonn"},
    {name: "Meier", vname: "Olga", City: "Bonn"},
    {name: "Meier", vname: "Peter", City: "Bochum"},
    {name: "Meier", vname: "Susi", City: "Bochum"}
    ));
    function mySort(event:DataGridEvent) {}
    var mySorter: sort = new Sort();
    Switch (event.columnIndex) {}
    case 1:
    mySorter.fields =]
    new SortField ("name", true),
    new SortField ("vname", true)
    ];
    break;
    case 3:
    mySorter.fields =]
    new SortField ("stadt", true),
    new SortField ("name", true),
    new SortField ("vname", true)
    ];
    break;
    }
    myData.sort = mySorter;
    myData.refresh ();
    }
    []] >
    < / mx:Script >
    < mx:DataGrid dataProvider = '{myData}' headerRelease = "mySort (event)" >
    < mx:columns >
    < mx:DataGridColumn dataField = "name" headerText = "Name" / >
    < mx:DataGridColumn dataField = "VNAME" headerText = "Vorname" sortable = "false" / >
    < mx:DataGridColumn dataField = "stadt" headerText = "Stadt" / >
    < / mx:columns >
    < / mx:DataGrid >
    < / mx:Application >

    Allright! So the column index begins with zero don't step one! It was the first.

    Secondly, once you have defined your own sorter, you don't want the default behavior of the event to pass by so you will add

    Event.preventDefault ();

    just after myData.refresh (); line.

    Give it a shot. should work.

    HTH.

    ATTA

Maybe you are looking for

  • Re: Satellite P200-1JR-S/PDIF is stereo only

    Hello.I have the Toshiba P200-1JR.When I connect laptop to hollow receiver optical cable and trying to watch movies with AC3 5.1 sound, I get only a stereo sound.1. the receiver works correctly with the PS3 and DVD player.2. in S/PDIF options I have

  • Problems reinstalling Windows Media Player 11

    try to reinstall Windows Media Player 11.  I me 8007F0DA error message and install aborts.  The link on the demolition nothing is available for this message.

  • Driver.cab and other files copy

    well hoping that someone can help because I'm lost... two weeks that ag has a virus that struck my notebook bad, then last night, that I decided re - install windows xp using the cd, everything has started big until the computer failed to copy some f

  • power paper jams OJ k5400

    I have a HP Officejet Pro K5400 running on Vista 32 bit. The gray wheel on the right pulls the paper in the printer but it keeps feeding the paper until it disintegrated upward in the feeder. He can't the grey rollers in the rear access panel. Flashl

  • Error in build Momentics: cannot reproduce ntoarm-ld

    I started getting this error today when you build a project BB10: CC: Rogue C:\Users\hambaa2\_bin\bbndk\host_10_3_1_12\win32\x86\usr\bin\ntoarm-ld failed: no such file or directory Neven has had this problem with the front structure. The file exists