Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Manipulating Query through industrial sql

Posted on 1998-03-24
2
Medium Priority
?
990 Views
Last Modified: 2008-02-01
Using Wonderware's industrial sql server (MS SQL server embedded), how can we change the output format of a query result.  When we run the following query

SELECT value, datetime, tagname
FROM history
WHERE tagname = 'temperature1'
AND DateTime > '24 Mar 1998 05:00'

we get a column of "temperature1" (column name is tagname) and a column of the actual temperatures (column name is value).  We want 1 column named temperature1 with all the values.  Additionally the AS syntax does not work, nor does the CASE statement.  Wonderware has been very little help.








 
0
Comment
Question by:rivercem
2 Comments
 
LVL 7

Accepted Solution

by:
Victor Spiridonov earned 200 total points
ID: 1090856
Do not include column with 'tagname' name in select list , if you wnat only temperature values type 'SELECT value FROM...', if you also want 'datetime' column use 'SELECT value,dateime FROM...'
You do not need to put field into select statement to use it in the WHERE clause
0
 
LVL 5

Expert Comment

by:perezjos
ID: 1090857
If you want all the values of tagname = 'temperature1'
try this query.

SELECT value as 'Temperature1'
FROM history
WHERE tagname = 'temperature1'
AND DateTime > '24 Mar 1998 05:00'
if you want all the values dont check the tagname.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question