Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Manipulating Query through industrial sql

Posted on 1998-03-24
2
Medium Priority
?
981 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

722 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