473,508 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get column name, first record name

Hello!
Can someone help me?

How to get for some records (like 0 or 1) column names?

Example:
I've got a table, that looks

server | parameter1 | parameter2 | parameter3
----------------------------------------------
server1 | 0 | 0 | 1
server2 | 1 | 0 | 1
server3 | 1 | 1 | 0

I want to have all with 0 value:

server | parameter
---------------------
server1 | parameter1
server1 | parameter2
server2 | parameter2
server3 | parameter3

So i need first record from each row and column name for it.
Can someone help me? Please...
I started with .NET in this week...
Nov 19 '05 #1
2 1604
It's an sql question. Following select will do.

select server, 'parameter1' as parameter from myTable where parameter1=0
union
select server, 'parameter2' as parameter from myTable where parameter2=0
union
select server, 'parameter3' as parameter from myTable where parameter3=0

Eliyahu

"Leszek" <ma***@zegarek.pl> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
Hello!
Can someone help me?

How to get for some records (like 0 or 1) column names?

Example:
I've got a table, that looks

server | parameter1 | parameter2 | parameter3
----------------------------------------------
server1 | 0 | 0 | 1
server2 | 1 | 0 | 1
server3 | 1 | 1 | 0

I want to have all with 0 value:

server | parameter
---------------------
server1 | parameter1
server1 | parameter2
server2 | parameter2
server3 | parameter3

So i need first record from each row and column name for it.
Can someone help me? Please...
I started with .NET in this week...

Nov 19 '05 #2
Thank you very much!
I thought, tha i must look into row, check each value, get the first record,
column name for this value and put it into a table :)
Użytkownik "Eliyahu Goldin" <re*************@monarchmed.com> napisał w
wiadomo¶ci news:ef**************@tk2msftngp13.phx.gbl...
It's an sql question. Following select will do.

select server, 'parameter1' as parameter from myTable where parameter1=0
union
select server, 'parameter2' as parameter from myTable where parameter2=0
union
select server, 'parameter3' as parameter from myTable where parameter3=0

Eliyahu

"Leszek" <ma***@zegarek.pl> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
Hello!
Can someone help me?

How to get for some records (like 0 or 1) column names?

Example:
I've got a table, that looks

server | parameter1 | parameter2 | parameter3
----------------------------------------------
server1 | 0 | 0 | 1
server2 | 1 | 0 | 1
server3 | 1 | 1 | 0

I want to have all with 0 value:

server | parameter
---------------------
server1 | parameter1
server1 | parameter2
server2 | parameter2
server3 | parameter3

So i need first record from each row and column name for it.
Can someone help me? Please...
I started with .NET in this week...


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2479
by: Michael March | last post by:
I have seen a few recipes out there that allow for access to DB-API columns by their name instead of column number.. I was wondering if anyone knew of any code snippets that allow for the same...
0
1009
by: Ben McLaurin | last post by:
I have a form with the info like First Name, Last name and a few other things, based off a table (TABLE B). I have a function that opens a list where the user can choose what records (multuple...
1
6124
by: Will | last post by:
I have a combo box on a form which is based on table tblMachine. On that combo box I have four columns visible MachineNumber, description, location and type. The bound column is the MachineNumber...
2
2743
by: .Net Newbie | last post by:
Hello, I am somewhat new to .Net and currently working on an intranet site using C# going against SQL Server 2k. I am accepting personal information on a single webform and trying to insert the...
3
2339
by: shiranaomi | last post by:
I'm wondernig if it's possible to do the following: I'd like to average every 2 numeric values in a table as they appear sequentially ordered by their time stamps. I was thinking the only way to...
6
3061
by: Hemant Shah | last post by:
Folks, Today, I was exporting a table in one database and then importing it in another database. The table in destination database was missing one column (my mistake while creating the table),...
3
3968
by: ApexData | last post by:
I have created a SearchForm which is basically a PopUp Continuous Form that displays 15 Fields. Each field is displayed as a column and when the user clicks on any record or row, the form closes...
4
4112
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi I have a GridView that is displaying master records. Some of these records have child records. I would like to a column to my master GridView such that for each master record that has...
0
3963
by: jeoffh | last post by:
Background: I am trying to "merge" some attributes into an existing XML column in my MS SQL 2005 database. The general idea is that I have an XML column in a table and I would like to update/delete...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.