472,331 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Query

Hi;

Can someone help me forming the following query.

I have a table with name, value, environment as column names. And the
data looks like

JMSHost prdIPAddress production
JMSHost devIPAddress development
JMSPort Portnumber production

As you can see, the config table contain the values for different
environments. I would like to select all the "production" values first
and overwrite with an specific environment value. For eg, if its
"development" I would like to get the data of rows 2 and 3.

I hope this is clear. I appreciate your help on this.

Thanks
Nov 12 '05 #1
4 1637
"Prakash" <ve***********@hotmail.com> wrote in message
news:78**************************@posting.google.c om...
Hi;

Can someone help me forming the following query.

I have a table with name, value, environment as column names. And the
data looks like

JMSHost prdIPAddress production
JMSHost devIPAddress development
JMSPort Portnumber production

As you can see, the config table contain the values for different
environments. I would like to select all the "production" values first
and overwrite with an specific environment value. For eg, if its
"development" I would like to get the data of rows 2 and 3.

I hope this is clear. I appreciate your help on this.

Thanks


Not clear to me. Rows 2 and 3 are development and production.
Nov 12 '05 #2
yes. 2 and 3 are dev and production. Since there are 2 rows for
"JMSHost" I want to take only one, which is "dev". So I want the
output to show JMSHost for "dev" (overwritten with JMSHost of
production) and JMSPort of production (since there are no JMSPort for
dev).

Thanks
Nov 12 '05 #3
ve***********@hotmail.com (Prakash) wrote in message news:<78**************************@posting.google. com>...
yes. 2 and 3 are dev and production. Since there are 2 rows for
"JMSHost" I want to take only one, which is "dev". So I want the
output to show JMSHost for "dev" (overwritten with JMSHost of
production) and JMSPort of production (since there are no JMSPort for
dev).

Thanks

How about this?

SELECT name, value, environment
FROM your_table X
WHERE environment = 'development'
OR environment = 'production'
AND
NOT EXISTS
(SELECT *
FROM your_table Y
WHERE Y.name = X.name
AND Y.environment = 'development'
)
;
Nov 12 '05 #4
Great. Thanks !!
Nov 12 '05 #5

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

Similar topics

2
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only,...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have...
4
by: Diamondback | last post by:
I have two tables, WIDGETS and VERSIONS. The WIDGETS table has descriptive information about the widgets while the VERSIONS table contains IDs...
14
by: Dave Thomas | last post by:
If I have a table set up like this: Name | VARCHAR Email | VARCHAR Age | TINYINT | NULL (Default: NULL) And I want the user to enter his or...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.