Solved

Manipulating Query through industrial sql

Posted on 1998-03-24
2
949 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:
spiridonov earned 100 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to convert JSON file to csv? 7 53
.htaccess file settings 4 35
SQL 2016 Setup - Connectivity Issues 4 14
Azure SQL DB? 3 15
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now