t-sql help

  • I need to compare data in two different columns in a table, reorganize the data so that any matches found in those columns gets grouped together (prefer blank rows between each set of matches) and then dump the whole mess out to excel ??   Can anyone help with this?

  • Some table definitons and data sample can help tremendously so can you please post some of that

    For the moment all I can do is just guess something like:

    select fld1, fld2

    from table t1 join table t2 on t1.fld1 = t2.fld2

    group by fld1, fld2

     


    * Noel

  • 17 Columns in Table F1, Outdoor, F2, F3, F4, F5, F6, F7, F8, F9, Medea, F11, F12, F13, F14, F15, F16, F17.  All columns are nvarchar and allow nulls.

    need to compare columns Outdoor (2nd column)  and Medea (10th column).

     

    not sure how to attach sample data

     

  • Help us help you.

    Please read this Page

    http://www.aspfaq.com/etiquette.asp?id=5006

  • Thank you for your patience  with me..

    CREATE TABLE [cities] (

     [F1] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [OUTDOOR] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F3] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F4] [float] NULL ,

     [F5] [float] NULL ,

     [F6] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F7] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F8] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F9] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [MEDEA] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F11] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F12] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F13] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F14] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

     [F15] [float] NULL ,

     [F16] [float] NULL ,

     [F17] [float] NULL

    ) ON [PRIMARY]

    GO

  • You missed the part about the sample data (last third of the page).

  • Believe it or not, we're not trying to pile on here...  But it would also be very helpful if you would provide an example of what you want the results of your query to be given the sample data.  I, for one, am not sure what you are really after here.

    P.S. your sample data certainly doesn't need to be a large set, just enough to get the point across.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply