473,387 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question about Field names

Hi

I have a question for you... what if I have a table with different
field names as example Field1,Field2,Field3,Field4 and Field5.
I want to make only one query where I can run it and based on the user
request I need to show for example Field1,Field2 from the table. The
second run of the query, the use change his input and runs Field1,
Field3...so the query had to adapt to the user input and display
Field1 and Filed3 and sooo on.
The idea is instead of making for every possible input a query...I
need to make one query which can display the result based on the user
selection of Field names.

thanks for your help
Nov 13 '05 #1
1 1236
"Pathfinder" <pa*************@yahoo.com> wrote in message
news:ce**************************@posting.google.c om...
Hi

I have a question for you... what if I have a table with different
field names as example Field1,Field2,Field3,Field4 and Field5.
I want to make only one query where I can run it and based on the user
request I need to show for example Field1,Field2 from the table. The
second run of the query, the use change his input and runs Field1,
Field3...so the query had to adapt to the user input and display
Field1 and Filed3 and sooo on.
The idea is instead of making for every possible input a query...I
need to make one query which can display the result based on the user
selection of Field names.


maybe something like this:

parameters [col1] int, [col2] int;
select switch
(
[col1]=1, Field1,
[col1]=2, Field2,
[col1]=3, Field3,
[col1]=4, Field4
) as FirstColumn,
(
[col2]=1, Field1,
[col3]=2, Field2,
[col4]=3, Field3,
[col5]=4, Field4
) as SecondColumn
from foo
Nov 13 '05 #2

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

Similar topics

2
by: Jason Reljac | last post by:
Howdy, I have a table full of names, last & first, and I would like to do a SQL select to get all of the last names that start with A-H (I'll run another for I-P & Q-Z). The resulting last...
0
by: Matthew Braumiller | last post by:
On Thu, 2 Oct 2003, "Gary Floam" <floam@comcast.net> wrote: >Sure you can do that. The easies way is to create a table of the last names >selected, and join that table into the query definition....
10
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along...
1
by: Johnfcf | last post by:
I have a database consisting of 3 tables, the main table with main contact info, a second table with additional address info and a third table consisting of additional contact information, or more...
6
by: HD | last post by:
Hello. For the following, I would appreciate if anyone could tell me: if it can be done, how it might done, and/or what search terms I could use to find the solution myself. I would like to...
3
by: Hanif Merali | last post by:
Hello, I'm having some difficulties creating a make table query. The source table which I'm basing the make table query has the fields: CIF BusLine1-2001 BusLine1-2002 BusLine1-2003...
5
by: Ale K. | last post by:
Hi, i'm designing my application that has a DLL that controls the Data Layer, and another that Controls the Bussines Layer, at some point my Bussines Layer need to Get an object ( Let's say a...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
2
by: Robert Dufour | last post by:
In an english only application, it is fairly easy to make the table and field names in your application descriptive so that on creating the interface, most tools that bind data take the default...
2
by: Robert Dufour | last post by:
In an english only application, it is fairly easy to make the table and field names in your application descriptive so that on creating the interface, most tools that bind data take the default...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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...

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.