SQL query to show "starts with" rather than "is like"

Hi friends,
I've written a query to show all BPs we have sold to in a particular Zip Code region. I have used WHERE T1.[ZipCode] like '%[%0]%'  but this brings up everyone where the zip code contains the phrase:
I want to search for Zip Codes starting "BT" it will bring in post codes like MK41 9BT.
How can I tell the report to bring in BPs where the Zip Code starts with "BT"
Thank you

Hi Tim,
Try this option also ,
WHERE left(T0.[e_mail],2)  like '[%0]%%'
OR
WHERE left(T0.[e_mail],2)  =  '[%0]'

Similar Messages

  • How to Use SQL Query having IN Clause With DB Adapter

    Hi,
    I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
    Thanks

    invoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • Can you set live bookmarks to show topic replies rather than new topics (or is that a setting of the site/forum)?

    I have live bookmarks for some forums, blogs, and news pages on my bookmarks toolbar and only one site shows topic replies rather than new topics in the dropdown bar. Can I configure the forum ones to show topic replies or is that a setting configured by the website itself?

    Nope. This is a common request, for some form of preview, typically as Outlook does it. Almost equally common are requests to have absolutely no preview whatsoever in case something nasty happens.
    Many of us think the Message Pane below the thread list is perfectly adequate for a quick scan of message content.

  • HT201269 I used Article: HT2109 to transfer everything from my iPod touch 3g, iOS 5.1.1, to my iPod touch 5g, iOS 6.1.3. Why did data from apps did NOT move to the new device? Games are starting over rather than picking up where they were on the old devic

    I used Article: HT2109 to transfer everything from my iPod touch 3g, iOS 5.1.1, to my iPod touch 5g, iOS 6.1.3. Why did data from apps NOT move to the new device? Games are starting over rather than picking up where they were on the old device?

    - If you restored the 5G frmm the iTunes backup of the 3G were th app in the iTunes library of the computer you used? They have to be.
    - If yes then try again. When I first restored my iPad 4 from the iTunes backup of my iPad 1 app data did not transfer. I tried again and it did.

  • Query to find records with more than 2 decimal places

    I have written the below query to find records with more than 2 decimal places, but it is returning records with decimal places 1 & 2.
    The datatype of the AMT column is NUMBER (without any precision).
    SELECT amt  FROM amount_table
    WHERE substr(amt, instr(amt, '.')) LIKE '.%'
           AND length(substr(amt, instr(amt, '.') + 1)) > 2Output:-
    AMT
    *41591.1*
    *275684.82*
    *64491.59*
    *3320.01*
    *6273.68*
    *27814.18*
    *30326.79*
    131.8413635
    162.5352898
    208.5203816
    8863.314632
    22551.27856
    74.716992
    890.0158441
    2622.299682
    831.6683841
    *1743.14*
    2328.195877
    3132.453438
    5159.827334
    3.236234727
    37.784
    Thanks

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    create table amount_table
      LINE_NUMBER        NUMBER not null,
      FEE_AMT            NUMBER not null
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (60208, 41591.1);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (60213, 275684.82);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (60238, 64491.59);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (63026, 3320.01);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (59906, 6273.68);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (83111, 27814.18);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (83114, 30326.79);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112395, 131.8413634682);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112399, 162.5352898104);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112402, 208.5203815738);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112403, 8863.3146321954);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112406, 22551.2785551322);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112407, 74.716992);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112410, 890.015844079);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112411, 2622.2996817048);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112414, 831.6683840698);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112415, 1743.14);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112418, 2328.1958771886);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112419, 3132.4534379886);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112422, 5159.8273341686);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112423, 3.2362347266);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112426, 37.784);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112427, 198.7423503696);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112430, 0.7220848332);
    insert into amount_table (LINE_NUMBER, FEE_AMT)
    values (2112433, 12.4149375254);

  • When you download a file and choose "open with" rather than "save as", what temporary folder is the file saved to?

    When I downloaded an important document, I accidentally chose "open with" rather than "save as" and I'm unable to re download the file to save it from the internet. I know its somewhere on my computer, but I can't find it! What temporary folder are the "open with" files saved to?
    Thanks,
    Kayla23

    hello, such files will be stored in the default windows temp folder. you can get to it by pressing windows-key+R & opening: '''%temp%'''

  • SQL Subscription field shows * only with Dynamic Text Label in SQL query

    We are using Hyperion Analyzer 7.2.x for showing budget and actual data. I have to show this financial data based on the security e.g. person in IT can see only IT dept. data. Hence I want to use dynamic text label <<userid>> for the security based on the person logging in to Analyzer.
    But when I use dynamic text label <<userid>> in the SQL query in SQL Spreadsheet, SQL Subscription field shows * only selection option. Does anyone have idea how to solve this problem?
    Thanks in advance for your help.
    -SV

    Hi
    Okay i know this is a bit crazy way.....but i think this is the solution for your issue.
    Create a report without the where clause (<<useris>>) then add a filter (sql subscription) then you can find all the values that are there in the SQL field (try to increase the query limit it is set to 250 as default) then edit the spreadsheet and add the where clause (<<userid>>).
    This will help you having the filter and the dynamic text label. I think there is an issue when you try to filter it with a where clause.
    Hope it helps.
    CK

  • Can 'track list' button show your playlist rather than album track list?

    Hi all
    My 3GS iPhone has my music on it in the form of whole albums which live in individual playlists on my Mac, but I also have playlist 'mixes' which I've created from various songs from multiple albums.
    When selecting to play a 'mixed' playlist on my iPhone I tap on it, tap the first song to start the music playing, but then if I tap the top right 'track list' button, instead of showing all the tracks in my created playlist it just shows the entire album tracks from where this particular song has come from. Visually I prefer the 'track list' screen but it seems I can't use it if I'm playing a 'mixed' playlist. Is there any way around this?
    Also, this is the same if I have a double CD album: once I hit the 'track list' button it shows just CD 1 (or 2 if I'm further down the play list of course), rather than all the tracks even though on they all live in one single playlist on my iTunes. I've even taken the starts of the track names off (some of them start with '1_01 Song Title' for example) when importing them into iTunes to see if that helps but it doesn't: the iPhone KNOWS how that track was originally supplied!
    Any help or clarification on this would be very helpful!
    Markos

    sadly, that kind of customization is only easily doable on a computer. the iPhone and it's core apps can not be changed by users. you can request the feature be put in, but unless there are a LOT of requests, you shouldn't get your hopes up as there are a lot of these kinds of requests, and by implementing it, how many other users would be angry and demand it be changed back? http://www.apple.com/feedback/
    if you are playing a song that you selected in a playlist, you should be able to hit the 'back' button in the top left to go back to the playlist and view your songs in the playlist.
    in regards to the 'cd 1 of 2' thing, you will need to change your song info to get this to show in the format you want. to see the song info, select a song and go to 'file -> get info'. that will show you all of the ID3 tag information, which you can edit to do whatever you want.

  • Query to show applications with administrative category value

    I'm trying to write a SQL query that will show applications that have a certain Administrative Category selected then show me the AppName and Deployment Collection......I'm struggling on where to start with tables or views and which ones.  I'm vaguely
    familiar with SQL queries but not an expert by any means.

    Hi,
    You may also check the following SQL views. This should be helpful.
    http://technet.microsoft.com/en-us/library/dn581963.aspx
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • SQL query to retrieve families with only one generation from a family db

    Hi,
    I need to write an SQL query that would select families with only one generation ((which means a person - or a married couple - with kids) or (a person - or a married couple - with parents but no kids)) from a database containing families. The simplified db structure is:
    person:
    id - int, primary key
    siblings:
    id
    parent_id
    kid_id
    marriage
    id:
    husband_id
    wife_id
    Could anyone please help me? I dont really have any idea how to accomplish that...

    Hi,
    Welcome to the forum!
    Assuming that siblings (despite its name) contains only parent-child relationships, and that the parent_id could be either the mother or the father:
    WITH     got_tree     AS
         SELECT     CONNECT_BY_ROOT  s.parent_id     AS root_id
         ,     LEVEL                     AS lvl
         FROM          siblings     s
         LEFT OUTER JOIN     marriage     m     ON     s.parent_id     IN ( m.husband_id
                                                            , m.wife_id
         START WITH     parent_id     NOT IN     (  SELECT  kid_id
                                               FROM        siblings
         CONNECT BY     s.parent_id     IN ( PRIOR m.husband_id
                                , PRIOR m.wife_id
                                , PRIOR kid_id
    SELECT       root_id
    FROM       got_tree
    GROUP BY  root_id
    HAVING       MAX (lvl)     <= 2
    ;This will get a list of parents who may or may not have children, but who do not have either parents or grandchildren.
    To get their spouses and children (if any) you will have to join this result set to all the other tables. At that point, you can eliminate poeple who do not have ancestors themselves, but are married to people who have more than one generation of ancestors.
    The details of how to do that depend on the details of your tables. If you'd like help, then post a little sample data (CREATE TABLE and INSERT statements for all tables) and the results you want from that data.
    Edited by: Frank Kulash on Oct 14, 2009 4:05 PM
    I'd need sample data in order to test this, of course.

  • I purchased an episode but it is only showing 30 seconds rather than the full 42 minutes. How do I get it to play the full episode as I can't seem to download it again?

    I downloaded a tv epsiode, but it doesn't show the entire 42 minutes. All I get is a clip of 30 seconds, rather than the entire 42 minute episode. I have tried to download the episode again, but it wont allow me to and I have also tried to download the series, but if I do that it wont deliver the epsiode that I already have suposedly downloaded. Anyone have any idea how to help?
    Thanks,

    Hi JAM147,
    Welcome to the Support Communities!
    The following information should help you with this:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    http://support.apple.com/kb/HT1933?viewlocale=en_US
    Cheers,
    Judy

  • Smartform output showing another language rather than english

    Hi Experts,
    in my system if any of the smartform/script output want to see it showing another language.it's not showing in english language.same smartform in my friend's system it is showing english only.
    Please suggest me the solution.
    Thanks in advance,
    Venkat.

    Hi
    See the attached 2 OSS notes for your problem
    OSSNote:960341
    Symptom
    In some device types (e.g HPLJ4, HPLJ5) you experience non-uniform character spacing in the PDF document after the PDF conversion of SAPscript or Smart Forms documents, using HELVE or TIMES fonts. You want to know the reason.
    Other terms
    CONVERT_OTF, SAPscript, Smart Forms
    Reason and Prerequisites
    The problem is not due to an error in the PDF converter but due to the fact, that the printer font, underlying the device type (e.g. Univers or CG Times in PCL-5 device types), is not available for the PDF converter and is either not available in Adobe Reader. The PDF converter has to try to simulate the layout of the printer font by means of a font which is predefined in Adobe Reader. This is done by assigning the letter widths of the printer font to the font used in Adobe Reader.
    The PDF file contains a table with letter widths, used by Adobe Reader in the output of text, for each used printer font (except PostScript fonts).
    Example:
    %Charwidth values from HP4300 HELVE 060 normal
    /Widths
    [ 278 333 500 633 633 1000 758 333 333 333 633...
    Adobe reader converts this width table, by modifying the space between each character, so that the specified letter width (= space between the current and the next letter) is kept.
    This 'Simulation' of printer fonts results in the sometimes visible irregular spaces in PDF.
    The PDF converter always uses the Helvetica Adobe PostScript font for the display of HELVE and the Times Roman Adobe PostScript font for the display of TIMES. However, for these Adobe PostScript fonts, Adobe Reader often uses a Windows TrueType font, which differs slightly from the original PostScript font.
    Solution
    Workaround: Use the POST2 PostScript device type or the PDF1 PDF device type for the PDF conversion of documents in the Latin-1 character set. They both use the Adobe PostScript fonts Helvetica or Times Roman for the HELVE/TIMES printer fonts.
    Header Data
    Release Status: Released for Customer
    Released on: 30.06.2006 12:44:06
    Priority: Recommendations/additional info
    Category: Consulting
    Primary Component: BC-CCM-PRN Print and Output Management
    Secondary Components: BC-SRV-SCR SAPscript
    OSS Note: 776507
    Symptom
    Documents printed via SAPscript or SmartForms do not print with correct special characters, e.g. ### prints instead of Japanese or Russian characters. What to do?
    Other terms
    SAPscript, SmartForms, printing, device types, OTF
    Reason and Prerequisites
    Help required to choose proper fonts in a SAPscript or SmartForm
    Solution
    When using SAPscript or SmartForms to print (or email or fax) a form from a business application, many factors influence the outcome of the actual text within the form. All these factors must be checked in order to ensure a correct printout:
    1) The language version of the form used to produce the printout.
    Example: If you want to print a French invoice, you need to have a FR version of your SAPscript or SmartForms invoice form RVINVOICE01. And the application program must specify the corresponding language key (FR) when calling the SAPscript or SmartForms API.
    2) The font selections specified in the form (possibly also in a SAPscript style or SmartStyle used in a form).
    Example: In a SAPscript form or a SmartStyle you need to specify HELVE if you want to print German text in Helvetica (or similar) font. If you want to print Japanese text, HELVE is not a valid choice but you need to specify a Japanese font like JPMINCHO in your Japanese form.
    3) The output character set of the device type
    Every printer in transaction SPAD has a "device type" assigned. Device types used by the spooler for printing support only one single specific output character set. All text from the form has to be converted (using SAP's built-in character conversion mechanism) to this output character set.
    A character set can typically support either a single language (e.g. Shift-JIS which supports only Japanese) or a set of languages (e.g. ISO 8859-1, which supports Western-European languages). It is possible that a given language (such as German) can be supported by several output character sets, e.g. you may use either ISO 8895-1 (Latin-1) or ISO 8859-2 (Latin-2) to represent German text. This is so because both character sets contain the special characters used in German.
    Example: HPLJ4000 is a HP LaserJet device type supporting the ISO 8859-1 (Latin-1) character set. ISO 8859-1 can be used to represent e.g. Dutch, English, French, German, Spanish, Swedish but NOT Russian or Japanese.
    As a consequence, it is ok to use HPLJ4000 to print English, German French etc. but not for Japanese or Russian.
    4) The set of available printer fonts for a given device type
    When formatting a document, SAPscript and SmartForms perform an automatic mapping of the font definitions in the form (e.g. "HELVE 14 point bold") and the available printer fonts of the device type. A replacement printer font is chosen, should the specified font selection not be available in the device type. Now this replacement can be problematic if a language-specific font, such as Chinese CNSONG, is specified in a form and it gets replaced by a font which does not support this language, e.g. COURIER.
    To solve this problem, font families in SE73 have language attribute assigned, e.g. some fonts are characterized as being suitable only for certain languages. And when a replacement has to be chosen because the original font from the form is not available in the device type, a replacement font is chosen which has the same language attributes.
    If no fonts for the language in question exist in the device type, the resulting font will not be able to print the special characters and you will see "wrong" output characters in the printout.
    Note on SAPscript/SmartForms Print Preview:
    The OTF Print Preview available in Windows GUI (e.g. from transaction SP01) will sometimes not show the "wrong" characters which appear on the final printout. Here is the reason: since the Print Preview runs in Windows environment, it will use Windows fonts to represent the actual printer fonts. A Windows font typically has more available characters (i.e. covers more character sets) than are actually available in a printer's resident font.
    A typical example where the Print Preview will differ from the printout is here: if you have a Chinese PCL5 printer such as CNHPLJ4 and use the Western Latin font COURIER in your document, the print preview will show you Chinese characters if you (by accident) tried to format Chinese characters in COURIER font. This is because Windows will automatically choose a font that can output Chinese characters (which is actually not Courier). But when you print the job on an actual PCL5 printer with resident Western and Chinese fonts, the Courier font will not print any Chinese characters but Western special characters instead, because the printer's resident Courier font does not include Chinese characters.
    Rule of thumb: all Asian device types (e.g. CNHPLJ4, JPHPLJ4, JPPOST, KPHPLJ4) support not only Asian fonts but also COURIER, HELVE and TIMES fonts. But these Latin fonts can only be used to print English text, not Chinese/Japanese/Korean characters.
    Which fonts are suitable for a given language?
    Language(s): Font family to use in a form:
    Latin-1 (Western Europe/Americas) *******
    DE,EN,FR,ES,NL,SV COURIER, HELVE, TIMES
    (LETGOTH, LNPRINT)
    Latin-2 (Central Europe) ****************
    PL, CZ COURIER, HELVE, TIMES
    ISO 8859-4 (Baltic) *********************
    ET, LT, LV COURIER, HELVE, TIMES
    ISO 8859-5 (Cyrillic) *******************
    BG, RU, SR, UK COURCYR, HELVCYR, TIMECYR
    ISO 8859-7 (Greek) **********************
    EL COUR_I7, HELV_I7, TIME_I7
    ISO 8859-8 (Hebrew) *********************
    HE COURIER, HELVE, TIMES
    ISO 8859-9 (Turkish) ********************
    TR COURIER, HELVE, TIMES
    Simplified Chinese **********************
    ZH CNHEI, CNKAI, CNSONG
    Japanese ********************************
    JA JPMINCHO, DBMINCHO, DBGOTHIC
    Korean **********************************
    KP KPBATANG, KPDODUM, KPGULIM
    KPGUNGSE, KPSAMMUL
    Traditional Chinese *********************
    ZF TWDPHEI, TWMING, TWSONG
    Thai ************************************
    TH THANGSAN, THDRAFT, THVIJIT
    Arabic (Unicode systems only) ***********
    AR ANDALE_J
    Verify your output by examining the OTF data
    When analysing printing problems of this type, be sure to check the OTF data which gets produced by SAPscript or SmartForms. OTF or "Output Text Format" is the intermediate page-description format generated from SAPscript or SmartForms. OTF will contain the final printer font names and character set/language identifiers which help to solve the problem. OTF will even name the form and the language of the form used to create the output.
    The easiest way to do this is to create a spool request from your application, run transaction SP01, use menu
    Goto->Display Requests->Settings
    and choose
    Display Mode: Raw
    Now display your spool request. If this is a SAPscript or SmartForms spool request, you will see OTF data. Each line represents one OTF command, every command starts with a 2-character cmd identifier and possibly some cmd parameters follow.
    Here is an excerpt from a sample OTF file where we highlight the most interesting commands:
    //XHPLJ8000 0700 00000000001
    IN04EALEXTEST_ZEBRA
    IN05%PAGE1
    OPDINA4 P 144 240 1683811906000010000100001
    IN06%WINDOW2
    MT0024401289
    CP11000000E
    FCHELVE 120 00109XSF100SF101110000067E X
    UL +0000000000000
    SW00067
    CT00000000
    ST0453037Dieses SF hat Stil ALEXTEST_ZEBRA mit
    The 1st line with the // (Control) command reveals the device type usedto print: HPLJ8000
    //XHPLJ8000 0700 00000000001
    The 2nd line (IN = Info command) shows the name and (internal 1-char)language key of the form:
    IN04EALEXTEST_ZEBRA
    In this case it is the English (E = EN) SmartForm ALEXTEST_ZEBRA
    The OP-line (OP = Open Page) gives the page format used in the form, it is DINA4 Portrait orientation:
    OPDINA4 P 144 240 1683811906000010000100001
    The CP (CodePage) cmd shows the SAP system codepage used to code the text and the active language. In our case it is codepage 1100 and language E = EN = English.
    CP11000000E
    Finally, the FC-cmd (Font Call) lists a printer font selected within SmartForms. Please note that every SmartForm has a designated default SmartStyle under "Form Attributes->Output Options". In addition, every text node can have a SmartStyle attached (which will override the definitions from the default style for the text). In our case the resulting printer font that was selected is HELVE 12.0 pt bold-off, italic-off.
    FCHELVE 120 00109XSF100SF101110000067E X
    Header Data
    Release Status: Released for Customer
    Released on: 22.08.2005 09:57:20
    Priority: Recommendations/additional info
    Category: Customizing
    Primary Component: BC-CCM-PRN Print and Output Management
    Secondary Components: BC-SRV-SCR SAPscript
    BC-SRV-SSF Smart Forms
    <b>Reward points</b>
    Regards

  • Connect By query without a Start with

    I have a database that takes a feed from a legacy system that has a rather illogical data structure that I need to tie together. The records chain together where the value in original_col equals the value of another records new_col. Using a connect by prior query I have the following results:-
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    with data_sample as (
            SELECT 'A129994' AS ORIGINAL_COL ,'A129993' AS NEW_COL FROM DUAL
            UNION
            SELECT 'A129996' AS ORIGINAL_COL ,'A129994' AS NEW_COL FROM DUAL
            UNION
            SELECT 'A129999' AS ORIGINAL_COL ,'A129996' AS NEW_COL FROM DUAL
            UNION
            SELECT 'B129994' AS ORIGINAL_COL ,'B129993' AS NEW_COL FROM DUAL
            UNION
            SELECT 'B129996' AS ORIGINAL_COL ,'B129994' AS NEW_COL FROM DUAL
            UNION
            SELECT 'B129999' AS ORIGINAL_COL ,'B129996' AS NEW_COL FROM DUAL       
            UNION
            SELECT 'C129994' AS ORIGINAL_COL ,'C129993' AS NEW_COL FROM DUAL
            UNION
            SELECT 'C129996' AS ORIGINAL_COL ,'C129994' AS NEW_COL FROM DUAL
    select original_col, new_col, level as connect_by_level
    CONNECT BY PRIOR original_col = new_col;
    Results:-
    ORIGINAL_COL            NEW_COL                 CONNECT_BY_LEVEL
    A129994                    A129993                             1
    A129996                    A129994                             2
    A129999                    A129996                             3
    A129996                    A129994                             1
    A129999                    A129996                             2
    A129999                    A129996                             1
    B129994                    B129993                             1
    B129996                    B129994                             2
    B129999                    B129996                             3
    B129996                    B129994                             1
    B129999                    B129996                             2
    B129999                    B129996                             1
    C129994                    C129993                             1
    C129996                    C129994                             2
    C129996                    C129994                             1The result I would like to have is just one chain for each set - however my issue is that I have no logical record for a START WITH clause.
    A129994                    A129993                             1
    A129996                    A129994                             2
    A129999                    A129996                             3
    B129994                    B129993                             1
    B129996                    B129994                             2
    B129999                    B129996                             3
    C129994                    C129993                             1
    C129996                    C129994                             2There is no specific record type that would be a start point such as a null parent, and the ID's used are in no logical order so I can't use the min value or a group b. Any pointers gratefully received.
    Edited by: jweb on 12-Jul-2012 04:51

    I think you need found root for your tree
    check following example
    with data_sample as
    (select 'A129994' as ORIGINAL_COL, 'A129993' as NEW_COL
        from DUAL
      union
      select 'A129996' as ORIGINAL_COL, 'A129994' as NEW_COL
        from DUAL
      union
      select 'A129999' as ORIGINAL_COL, 'A129996' as NEW_COL
        from DUAL
      union
      select 'B129994' as ORIGINAL_COL, 'B129993' as NEW_COL
        from DUAL
      union
      select 'B129996' as ORIGINAL_COL, 'B129994' as NEW_COL
        from DUAL
      union
      select 'B129999' as ORIGINAL_COL, 'B129996' as NEW_COL
        from DUAL
      union
      select 'C129994' as ORIGINAL_COL, 'C129993' as NEW_COL
        from DUAL
      union
      select 'C129996' as ORIGINAL_COL, 'C129994' as NEW_COL from DUAL)
    select original_col, new_col, level as connect_by_level
      from (select ds.*,
                   case (select count(*)
                       from data_sample dsc
                      where dsc.original_col = ds.new_col
                        and rownum < 2)
                       when 0 then
                        1
                       else
                        0
                   end as is_root -- try find parent in table if parent not exists this record is root
              from data_sample ds) ds
    start with is_root = 1
    connect by prior original_col = new_col;good luck

  • SQL Query to show active alerts

    Hi, i want to build a ASP page that shows a gridview with the current alerts in scom so we can see them clearly.
    What SQL query can get me the current alerts that are showing on Monitoring - Active Alerts, where severity is Critical?
    I use System Center 2012 SP1
    I checked this post
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/898c6f62-9daf-493b-bfd9-193d1f42fc18/sql-query-to-view-current-active-alerts?forum=operationsmanagergeneral
    And this page:
    http://blogs.technet.com/b/kevinholman/archive/2007/10/18/useful-operations-manager-2007-sql-queries.aspx
    But i can't see the correct query.
    I don't want to use Powershell as i want to display it properly in a formatted gridview.
    Thanks

    Hi,
    SELECT * FROM [OperationsManager].[dbo].[AlertView] where Severity = 2 and ResolutionState <> 255 and LanguageCode='ENU'
    I want to report on all severity levels, but I'd like to see Warning instead of 1, and Critical instead of 2 and so on. Am I missing a field somewhere?
    Jeffrey S. Patton Jeffrey S. Patton Systems Specialist, Enterprise Systems University of Kansas 1001 Sunnyside Ave. Lawrence, KS. 66045 (785) 864-0242 | http://patton-tech.com

Maybe you are looking for

  • How to create editable select box in jsp page

    hi, i got som peculiar requirement in my jsp page.i have my page like this. <html> <body> <form name="test"> <select name="test"> <option value="one">USA</option> <option value="two">India</option> <option value="three">UAE</option> </select> </body>

  • Dynamically assigning Header to Details Section in Map

    Hi, I need to map the details from header to details section based on the condition. When a Batchcode matches in the header section, I need to assign the address details from header to details section in a map. Input: <?xml version="1.0" encoding="ut

  • Changing ZFS options on boot drive before install

    Hello, I would like to install Solaris on a new server but I am hoping that it's possible to set up ZFS on the boot drive (which happens to be an SSD), modify some of the options and then have Solaris install onto this. In particular, I would like to

  • Datapump Export Wipro Question

    Hi, we are having a 50GB size of Schema but the Dumpfile size will be 5GB only, now what the question is , How can we Export this 50gb Schema using the 5GB Dumpfile? Is this is posible? Give me the solution for this with query?

  • Window resizing help

    I've been trying different ways of getting a window resize its height. I tried applescript and Objective C with applescrict call. The window sizes but not the way it needs to. When the position is changed the window appears to shade/slide upward. and