Results 1 to 2 of 2

Thread: [RESOLVED] How to use Cast for three columns?

  1. #1

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Resolved [RESOLVED] How to use Cast for three columns?

    Hello people,

    I have made following query

    this one works fine

    Code:
    SELECT DISTINCT
    CAST (tt.OrderNr AS varchar(10)) + ' – ' + PostIt.Text AS 'Context Matches' 
    FROM [Teknotrans_dev].dbo.OpusOrder as tt INNER JOIN
    [MyDB].dbo.CompanyMain as c On tt.bolagsnr = c.id INNER JOIN
    [MyDB].dbo.OpusOrderrow as ord On ord.ordernr = tt.ordernr INNER JOIN
    [MyDB].dbo.PostIt as PostIt On PostIt.ordernr = tt.ordernr INNER JOIN
    [MyDB].dbo.OrderCompanyName as snSrc ON ord.kallspraknr = snSrc.spraknr INNER JOIN
    [MyDB].dbo.OrderCompanyName as snTrg ON ord.malspraknr = snTrg.spraknr
    Now is my issue...

    I want to include one column more to the cast seperated by "–"

    columnname is:
    tt.quationnr

    the column contains two different values 0 or -1

    could someone help me?

    Thank you in advance

  2. #2

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Re: How to use Cast for three columns?

    Already solved my bad

    SELECT DISTINCT '(' + CAST (tt.offertnr as varchar(10))+ ')'+ CAST (tt.OrderNr AS varchar(10)) + ' – ' + PostIt.Text AS 'Context Matches'

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width