Sybase

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSybase

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old February 26th, 2015, 11:23 AM
digioleg54 digioleg54 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2013
Posts: 5 digioleg54 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 5 m 10 sec
Reputation Power: 0
How to eliminate one header column from select statement

I have statement:
select col1,col2,col3,col4,col5
from table A

I want to see the result headers:
col1,col2,col3
but no col4 and col 5 even though they are in select statement.

I try to do:
select sol1,col2,col3
case when exists (slect 1 from table B) then col4 end
case when exists (slect 1 from table B) then col5 end

But in this case I get result :
col1 col2 col3 col4 col5
1 1 1
2 2 2

col4 and col5 exists, but with value NULL.
Please help me withis query.

Thanks,
Oleg

Reply With Quote
  #2  
Old October 17th, 2017, 08:34 AM
pranawcs pranawcs is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2017
Posts: 0 pranawcs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 50 sec
Reputation Power: 0
Quote:
Originally Posted by digioleg54
I have statement:
select col1,col2,col3,col4,col5
from table A

I want to see the result headers:
col1,col2,col3
but no col4 and col 5 even though they are in select statement.

I try to do:
select sol1,col2,col3
case when exists (slect 1 from table B) then col4 end
case when exists (slect 1 from table B) then col5 end

But in this case I get result :
col1 col2 col3 col4 col5
1 1 1
2 2 2

col4 and col5 exists, but with value NULL.
Please help me withis query.

Thanks,
Oleg


Please try below:

select a.COMP_CODE, a.BRANCH, a.PLAN_NBR from (select COMP_CODE, BRANCH, PLAN_NBR, PLAN_SEQ, LINE_NBR
from ABC)a

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSybase > How to eliminate one header column from select statement


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap