I have a table that has process engines 1,2,3,4,5,6 with a running status. When one of the engines is down the record gets deleted from the table. Using a case statement I can display the first engine that is down but how do I go about displaying the engines if 2 or more engines are down. For e.g. how do
How to get current and previous ids of current id in one query(mysql)
My table is like this: The current empid is for example 10, I want the previous and next empids from the database. The next and previous values may not be 11 and 9 respectively, I need to get it from the database only in a single query. Could any body please help me with this? Answer ex. empid = 4
SQL Server: Replace invalid XML characters from a VARCHAR(MAX) field
I have a VARCHAR(MAX) field which is being interfaced to an external system in XML format. The following errors were thrown by the interface: mywebsite.com-2015-0202.xml:413005: parser error : …
Check whether value exists in column for each group
Having a difficult time putting what I am trying to do into words so searching is also difficult. Basically I am trying to look whether a certain value exists in a column, partitioned by group, and then propagate that value forward. In this example I want to check whether a user has completed the tutorial and…
Class.forName(JDBC_DRIVER) no longer needed?
I’ve read here on SO that since java 6 you no longer need to register JDBC Driver using: Class.forName(JDBC_DRIVER); because DriverManager uses the path located in system property “jdbc.drivers” …
Access Query – [col]/[col].[col]?
Just inherited an Access database and trying to figure some things out. For the life of me, I have no idea what this query means. Its like the [col1]/[col2] is the table name and [col3] is the column. But instead of a table, it is math function (dividing two columns) followed by the column name. SELECT table.…
Convert Hibernate @Formula to JOOQ field
I am rewriting entire DB access layer from Hibernate to JOOQ and I face following issue. One of JPA models is annotated with @Formula annotation as follows: Later in the code, a JPA query is made against the database which compares fee5 to parameter: How can above query be translated to JOOQ DSL? Answer I man…
using sql – Is not null in a select statement
I can’t seem to figure out how to use the opposite of isnull or ifnull statements in sql. I need to say if a.Error1 is not null — then print the ‘ – ‘ and the + CHAR(13)+CHAR(10). Basically There should be no dash or no new line break if the a.Error1 comes back null. So print the…
How to declare sql variable in C#
My requirement is to remove all record but one from a table. For this I am executing a series of two different sql commands. Seems like on ssms it works fine but with C# is not –This is what I run …
ODBC error – SQL0104 – Token = was not vaild. Valid tokens: ( + – ? : DAY INF NAN RID ROW – Crystal report error in windows 7 machine
Our client have been using several crystal reports for many years in the windows XP machines and I am responsible for supporting these reports. It was working perfectly fine. Recently we have upgraded to windows 7 machine and one of the crystal report stopped functioning wherheas other crystal reports works c…