Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1 row insted of 2....

Status
Not open for further replies.

magmo

Programmer
May 26, 2004
291
SE
Hi


I have this sql question...

Code:
SELECT DISTINCT FileName, Lang, Artno
FROM         dbo.tbl_ArticleFiles
WHERE     (Artno = N'123456') AND (Lang = N'SE') OR (Lang = N'GB')

This give me 2 rows that looks like this...

FileName Lang Artno

file1_se.txt SE 123456
file1_gb.txt GB 123456



Is it possible to get the result like this instead.


FileName1 FileName2

file1_se.txt file1_gb.txt



Best Regards


 
Rotate display 90 degrees counter-clockwise. Any $50 gfx card can do that [poke].

What if one ArtNo has more than two FileNames?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Hi


That query will never return more than 2 records.



Regards
 
well, if you only want those two rows, just do this --

Code:
select 
  ( select FileName 
      from dbo.tbl_ArticleFiles
     where Artno = N'123456'
       and Lang = N'SE' ) as filename1
 ,( select FileName 
      from dbo.tbl_ArticleFiles
     where Artno = N'123456'
       and Lang = N'GB' ) as filename2

r937.com | rudy.ca
 
Hi


Excellent!, Thanks a lot!



Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top