Data to be returned in a specific format .

Hi Guys,
Data of a specific style is style table
Data of colour is in  Colour table
The common column is stylecode between both tables .
I will need the data to be returned in this format when run in the SSMS.
Stylecode
Style
Colour
ColourCode
countColour
LJ
Leather Jacket
Black
BK
1
Brown
BN
2
Grey
GY
3
JS
Jeans Skirt
Blue
BE
1
Pink
PK
2
Green
GN
3
White
WT
4
Many Thanks,
C.

Try the below:
create Table style (stylecode varchar(2),name varchar(100))
Insert into style Select 'LJ' , 'Lether Jacket'
Insert into style Select 'JS' , 'Jeans Skirt'
create Table Color (stylecode varchar(2),Color varchar(100),Colorcode varchar(10),countColor int)
Insert into Color Select 'LJ' , 'Black','BK',1
Insert into Color Select 'LJ' , 'Brown','BN',2
Insert into Color Select 'JS' , 'Blue','BE',1
Insert into Color Select 'JS' , 'Pink','PK',2
Insert into Color Select 'JS' , 'Green','GN',1
;WITH List
AS ( SELECT A.*,B.Color,B.Colorcode,B.countColor ,
ROW_NUMBER() OVER ( PARTITION BY A.styleCode ORDER BY A.stylecode asc ) AS RN
FROM style A
Inner Join Color B On A.stylecode = B.stylecode
SELECT CASE WHEN RN = 1 THEN stylecode
ELSE NULL
END AS styleCode ,
CASE WHEN RN = 1 THEN name
ELSE NULL
END AS stylename,Color,Colorcode,countColor
FROM List;
Drop table Style,Color

Similar Messages

  • How to set first column as date (dd/mm/yyyy) in the specific format in excel

    hi need help wat i did need help is tht i need wen ever i send view a excel data  the first column set to date  but some times wen i view in different type of pc the date format change to mm/dd/yyyy. is  thr any way i can set the format?

    If you just need to reformat a correct date to show up as dd/mm/yyyy, just use the "Format Cells" command and set a custom format string to exactly that. If, on the other hand, you are finding that Excel just doesn't get that the first value is a DAY, not a month, such as trying to graph a temperature data logger that records data in dd/mm/yyyy:
    Reformat the strings as dd/mm/yyyy, using the first method. This will make them LOOK correct, even though the actual date VALUES are still day-month inverted. Now save the table as a .CSV file. This will save the dates as plain text in the correct order, which you can then re-import and have Excel now read the correct date value.
    Ryan R.
    R&D

  • How can I get responses to return to a specific email address?

    How do I get all my for responses to return to a specific email address? Does the Acrobat user need to be logged in with this email or is there an option for this?
    Any help would be appreciated!

    Looks to me like the Distribute Forms feature in Acrobat taps into the email address you have specified in Acrobat as your identity; that's where it gets the mailto: address associated with the submit button in the document message bar. 
    Furthermore, if you create a form in LiveCycle the distribute process still seems to tap into Acrobat.  Just for grins you can open the distributed form in LiveCycle (better make and open a copy so you don't break the Reader extended usage rights), go & look in the object palette at the submit address property of your email submit button and it will be blank.  Surprise!  This data has migrated to one or more than one script at the document level.  And if your user then opens your LiveCycle-made form in Reader to complete and return, the submit button in the document bar corresponds to your identity email address in Acrobat.
    So I managed a quick but ugly workaround for an email submitted form by:
    Going into Acrobat:Edit/Preferences/Identity
    changing the email address in my identity to the desired return address
    distributing my form (can do either in LiveCycle or in Acrobat)
    putting my Identity email address back where it was afterwards.
    Good luck with all that.  And if anyone knows a more elegant method, do share!

  • CAMl Query -CSOM - Display Modified date of list Item in a required format

    Hi All,
    I want to display last modified date of a List Item.
    I am getting the value in this format : 
    Tue Feb 25 23:06:57 PST 2014
    How ever, I want to display it as : Tuesday 25th February 2014
    Please suggest how to achieve this.
    Any informative articles, links w.r.t building such queries in CSOM (jQuery) is welcome.
    Thanks.

    I have the query : 
    function ReadListItem() {
                siteUrl = "my site Url";
                var listTitle = "NewsList";
                //Get the current client context
                var context = new SP.ClientContext(siteUrl);
                var newsList = context.get_web().get_lists().getByTitle(listTitle);
                var camlQuery = new SP.CamlQuery();         
                camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'Modified\' Ascending="FALSE"/></OrderBy><RowLimit>1</RowLimit></Query></View>";')
                this.listItems = newsList.getItems(camlQuery);
                context.load(listItems);
                context.executeQueryAsync(ReadListItemSucceeded, ReadListItemFailed);
            function ReadListItemSucceeded(sender, args) {
                var itemsString = '';
                var enumerator = listItems.getEnumerator();
                while (enumerator.moveNext()) {
                    var listItem = enumerator.get_current();
                    itemsString += 'Modified On: ' + listItem.get_item('Modified');
                $("#P1").append(itemsString);
    I am able to get the Modified Date using the query
    But I need it in a specific format like : Tuesday 25th February 2014
    Please suggest

  • Parsing VARCHAR to DATE where the VARCHAR column has multiple format

    Hello,
    I'm a little stumped here so I figured I'd try posting here.
    I have an application where I can not alter the code. This application has a form with a calender conrol on it that allows the user to select a date. This form is internationalized so date formats vary based on the country the user is coming form (mm/dd/yyyy, dd-Mon-yyyy, dd.mm.yyyy, etc). The application saved the string of the date as the calender control returns to the form, it does not save the value as a date value.
    I need to preform a query that can do some cacluations off of this date. When there is only one date format returned in the query, there is no problem
    CASE WHEN TO_DATE(d3.data,'Mon/dd/yyyy')-NVL(trunc(i3.end_date),trunc(SYSDATE)) < 0 THEN calc_business_days(TO_DATE(d3.data,'Mon/dd/yyyy'),NVL(trunc(i3.end_date),trunc(SYSDATE)))
    WHEN TO_DATE(d3.data,'Mon/dd/yyyy')-NVL(trunc(i3.end_date),trunc(SYSDATE)) > 0 THEN 0-(calc_business_days( NVL(trunc(i3.end_date),trunc(SYSDATE)) ,TO_DATE(d3.data,'Mon/dd/yyyy')))
    ELSE 0 END
    However, this errors when there are multiple formats in the varchar column for the same query. Can anyone provide any guidance on how to handle this? I am using Oracle 10g.
    Thanks

    The simplest option is generally to create a new function that does the conversion and sets up a hierarchy of date formats. Obviously, there may be some data loss here-- '01/02/03' is a valid string in the format mm/dd/yy, dd/mm/yy, and yy/mm/dd but it means different things in each.
    Something like
    CREATE OR REPLACE FUNCTION my_to_date( p_in_string VARCHAR2 )
      RETURN date
    IS
    BEGIN
      RETURN to_date( p_in_string, 'MM/DD/YYYY' );
    EXCEPTION
      WHEN others THEN
        BEGIN
          RETURN to_date( p_in_string, 'DD-MON-YYYY' );
        EXCEPTION
          WHEN others THEN
            BEGIN
              RETURN to_date( p_in_string, 'DD.MM.YYYY' );
            EXCEPTION
              WHEN others THEN
                RETURN NULL;
            END;
        END;
    END;
    /Justin

  • Make a number in column A always return a different specific number in column B

    I'm trying to create a retirement calculator.
    How do I set it up so that no matter where a specific number appears in column A, column B, same row, always returns a different specific number.
    This second number cannot be derived from the first mathematically.
    example:
    Column A your current age is entered in the first cell.
    Column B is the Life Expectency Factor (LEF). Before age 70 it is 0.  At age 70 that number is 24.7, at 71 it is 26.4 etc.
    Column C returns the Minimum Required Distribution (How much one has to withdraw) (B * $IRA = $MinDist)
    Depending on the age in the first cell of column A, age 70 could be in any row.
    How can I have the LEF in column B move with the age so that no matter in which row age 70 may appear in column A, that row in column B always returns 24.7 and age 71 always returns 26.4... and on.
    No matter which row 70 is in, 24.7 is always next to it in the same row. This will go from 70 to 100 each with a specific LEF next to it.
    Thanks

    Hi Les,
    Setup a Lookup table listing the LEF in column B beside each age in column A. Assuming one header row, start with 0 and 0 in A2 and B2, 70 and 24.7 in A3 and B3, etc.
    On your Main table, enter the formula below in the first data cell of Main::column B (B2, again assuming a single header row for labels). Fill the formula down to the end of the table.
    Main::B2: =LOOKUP(A,Lookup::$A,Lookup::$B)
    Fill the formula to the end of column B
    Numbers on the lookup table on the right are from the (US) government Social Security Administration Actuarial Life Table, and may not (do not, for the two examples in your post) agree with those you are using.
    Regards,
    Barry

  • Extract text with specific format ?

    Hello,
    Is there a way to extract text with a specific format in a document (i.e. font type/ size or even font colour)?
    thanks in advance!

    Hello gillad,
    I am afraid only indicators are the bold font or text colour...
    Having said that, just as I was writting my response, the following idea came to me:
    Convert the pdf into word
    Click on text of interest (text with distinct format)
    Use the feature "select all text with similar formating (no data)" under "editing" within the "home" ribbon
    Having said that, hopefully a tool set/ action can be developed one day...

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • How to conver a BINARY Table in specific format Documento to send by e-mail

    Hello all
    i am trying to send a file that is located in application server, this file was created in BINARY MODE, so now i need to download from this server and then send it by e-mail, i haver already download in BINARY MODE but when i send it and i open this appears in BINARY MODE i need to see in the specific format, for example:
    I have a FILE.XLSX which is BINARY MODE in the server and i used this function to download it
    CALL FUNCTION 'C13Z_RAWDATA_READ'
        EXPORTING
          i_file           = input_file
        IMPORTING
          e_file_size      = lv_file_size
          e_lines          = lv_lines
        TABLES
          e_rcgrepfile_tab = it_tab
        EXCEPTIONS
          no_permission    = 1
          open_failed      = 2
          read_error       = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        w_doc_data-doc_size = lv_file_size.
        LOOP AT it_tab INTO wa_itab.
          t_attachment-line   = wa_itab-orblk.
          APPEND t_attachment.
        ENDLOOP.
      ENDIF.
    fter to recive the file in binary mode i move it to the internal table  t_attachment, after that i send it by e-mail,
    w_doc_data-obj_langu  =  sy-langu.
      w_doc_data-obj_name   =  'EDISO'.
      w_doc_data-obj_descr  =  ld_mtitle.
      w_doc_data-sensitivty =  'F'.
    *--> Crea el cuerpo del mensaje
      t_packing_list-transf_bin =  space.
      t_packing_list-head_start =  1.
      t_packing_list-head_num   =  0.
      t_packing_list-body_start =  1.
      DESCRIBE  TABLE  it_mensaje  LINES  t_packing_list-body_num.
      t_packing_list-doc_type  =  'RAW'.
      APPEND  t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin  = space. "'X'.
      t_packing_list-head_start  =  1.
      t_packing_list-head_num    =  1 ."5.
      t_packing_list-body_start  =  1. "5.
      IF t_attachment[] IS NOT INITIAL.
        DESCRIBE  TABLE  t_attachment  LINES  t_packing_list-body_num.
        t_packing_list-doc_type   =  c_format. THIS IS THE FORMAT I NEED TO SEE THE FILE FOR EXAMPLE: XLSX
        t_packing_list-obj_descr  =  ld_attdescription.
        t_packing_list-obj_name   =  ld_attfilename.
        t_packing_list-doc_size   =  t_packing_list-body_num * 255.
        APPEND  t_packing_list.
      ENDIF.
    But when i open the mail and open the file attach appears in BINARY so i need to see in XLSX format,
    Thanks a lot for you help

    Thanks for you help

  • How to store date in destination with dd-mmm-yy format in SSIS.

    Hi,
    I have an excel source where one of the column has date in it. I want to store this date into destination in DD-MMM-YY format in SSIS package.
    Thanks and regards,
    Anand.D.S.

    Whats your destination?
    If its SQLServer then I would say ita a bad idea to change the datatype for formatting. By default dates are stored as numerical data internally within SQLServer and would be displayed in YYYY-MM-DD format in SSMS. What you need to do is to store it as dates
    and then wherever you want to display change the format in the way you want using formatting functions. If you dont have proper front end you can use CAST,CONVERT or FORMAT (SQL 2012)  to get it in the format you want
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • What data does SNMP return and what is the best way to explore it?

    Hi All
    I have some queries about using SNMP on Cisco devices.
    1. What is the best way to get an idea of what data MIBs can return?
    I have entered the commmand "show snmp mib". However, the number of MIBs generated is huge!
    2. Can you enter a command on the Cisco device itself that returns snmp data?
    e.g. if I want to see what data a MIB entry returns, can I interrogate it on the Cisco device itself rather than having to rely on network management software?
    The reason I ask is that we are currently looking for Network Management Software. However, I have no idea what data SNMP can return, therefore don't know if what the Management Software offers is comprehensive or not.
    Any suggestions on how best to get an idea the data SNMP can generate plus any other suggestions are very welcome!
    Thanks
    John

    Generally speaking, snmp can query about any parameter of the system. An enterprise class device has almost all conceivable parameters instrumented thus. A device's inventory (chassis, cards, ports, power supplies, software image, etc.) and the state of its interfaces and traffic they are carrying are among the primary ones.
    You can query a device's snmp variables remotely "by hand" using an open source distribution of a tool like snmpwalk. You need to know what you're looking for - i.e., the exact oid (object ID) string or else you get a long reply like you alluded to. It also helps to have the actual MIB you are querying against locally so that the output you get will be human-readable. Otherwise you'll get long numeric strings (the snmp oid) followed by alphanumeric values which may or may not make sense at first glance depending on the oid being queried. A MIB's purpose is to add that abstraction layer / interpretation to make the output more useful to the operator.
    The purpose of an NMS (very generally speaking) is to give an even higher layer of abstraction to organize the querying and reporting of all these various data into a useful system with dashboards, graphs, reports etc.

  • How to save data model design in pdf or any format..?

    how to save data model design in pdf or any format..?
    i ve created design but not able to save it any mage or pdf format

    File -> Print Diagram -> To PDF File

  • Date to show in MM/DD/YYYY format

    Hi all,
    I am stumped on this simple thing under BIP.How can I get the date to show in MM/DD/YYYY format under BIP ?
    Template is created under word, for the field under formatting, type: date, format:M/d/yyyy ( can't find MM/DD/YYYY). But when I browse the document, it always show as "DD-MON-YYYY" format.
    How to mitigate this ?
    Thanks
    Munshar

    Hi ,
    hey small mistake in my solution code,just change the format to dd/MM/yyyy (case sensitive code)then it will work
    to-char() is used to convert the Date or Number format type to displayable string format.
    In our case also it is coverting xml_date_filed into a string to the format of dd/MM/yyyy
    so you can try with this formula
    in Advanced tab write
    *<?xdofx:to_char(MY_DATE_FIELD,'dd/MM/yyyy')?>*
    or in properties tab ,under formatting section ,select type as DATE and write the format as dd/MM/yyyy
    best/Aravind
    Edited by: Aravind on Aug 18, 2011 9:58 AM, with correct solution

  • Data element for time in 12 hour format HH:MM

    Hi friends,
    Is there any data element which is for HH:MM format 12 hour format?
    i see uzeit, but its HH:MM:SS. i dont want this.
    i want HH:MM.
    Niraja

    Rohan,
    I am trying to create a new Domain with data type Tims. Basically when i change the no. character to 4.. its not taking
    by default its making it as 6. How to make this to 4.
    i can give Numc, but i needed in HH:MM format.  with : in between.
    can u help me out.
    Niraja

  • ABAP program to output data from SAP table to an XML format file?

    hello ABAP experts,
    Does anyone know how to output data from SAP table to an XML format file?  Would be appreciated if someone show the detailed sample codes and we will give you reward points!
    Thanks!

    Edited by: Jose Hugo De la cruz on Aug 19, 2009 8:23 PM

Maybe you are looking for

  • How to access Enter prise portal

    Hai Friends, EP is implimented in our co., I am new to EP.                                           How 2 login 2 EP and how to Access plz tell me the procedure clearly. I hope that I ll get spontanious  answers from ur side. Regards Jaggu

  • Portal tab security

    I have a page with item level security enabled for the page. I have added 5 tabs on one of the sections, and have set security for each of the tabs. On one of the tabs I limited the access to 1 group, however anyone that has access to the page group

  • CC Desktop and CS6

    I am not a Cloud subscriber, staying with CS6 for now. The other day, I received CC Desktop via Adobe Updater. I see several CC apps have the option "Install" (notably Bridge CC). Cna I just install these and use them with CS6?

  • Calendar program has dropped all my calendars and appointments.

    For some reason my calendar program on my iPad has lost all my calendars and appointments. The one for my iMac, Macbbook Pro and iPhne are still ok. What do I do now? How do I force it to sync up again? Any help appreciated.

  • Just loaded iphoto on my ipad to make a calendar. Directions are select photos and select calendar from toolbar. No toolbar and no calendar option. Help

    JUst loaded iphoto on my ipad to make a calendar. Direction are select photos and hit calendar icon on toolbar at the bottom.  There is no toolbar at the bottom and nowhere is there a calendar icon.  Please help.