I've got three tables
AUTHOR_TABLE
-------------
AUTHOR_ID (PK) AUTHOR_NAME
1 me
2 you
ARTICLE_AUTHOR_TABLE
-------------
AUTHOR_ID ARTICLE_ID
1 100
2 101
EVENT_AUTHOR_TABLE
------------------------------------------
AUTHOR_ID EVENT_ID
1 200
1 201
All ...
Hi all,
I need help in how to transfer data from one account no to another account no in single table.
In this customer will get his account no from dropdown list(it will come automitically thru his session) and customer has to write the destination account no in textbox and the amount he is transferring will be written in another textbo...
I asked a question before and received this answer:
SELECT table1.id, GROUP_CONCAT(table2.values)
FROM table1
INNER JOIN
table2
ON FIND_IN_SET(table2.id, table1.nos)
GROUP BY
table1.id
But I have another field nos1 (with multiple values) in table1 that also pointing to table2, I use it like this :
SELECT ta...
I'm working on a project which will pull data from two different tables, Events and Travel Times. I'm displaying it in a DataList using ItemTemplate. Almost all of the information displayed in the DataList will be from Events and will always be displayed. The data from Travel Times will only be shown if it falls within a certain range of...
Hi everyone.
I'm selecting a value out of a table that can either be an integer or a nvarchar. It's stored as nvarchar. I want to conditionally call a function that will convert this value if it is an integer (that is, if it can be converted into an integer), otherwise I want to select the nvarchar with no conversion.
This is hitti...
Hello everyone,
I'm looking for a way to loop through the columns of a table to generate an output as described below.
The table looks like that:
ID Name OPTION1 OPTION2 OPTION3 OPTION4 OPTION5
1 MyName1 1 0 1 1 0
2 MyName2 0 0 1 0 0
And the output looks like that:
MyName...
I currently have a SQLTIPS.sql file, which lives on my hard disk, at work.
I'll add any new or nice examples, of writing good SQL, to this file. Now it's becoming hard to manage, and I have to search for specifics, in my own file!
I am looking for something that can be loaded in SQL Enterprise Manager quickly, something similar to V...
Hi to all.
I have a form where users can specify various parameters to dig some data (status, date ecc).
I can producea query that is:
SELECT * FROM table WHERE:
status_id = 3
date =
other_parameter =
etc. Each WHERE is optional (i can select all the rows with status =3, or all the rows with date = 10/10/1980, or all the rows with st...
Recently at my day-job were were instructed that any comments regarding our stored procedures MUST NOT exist inside the stored procedure and rather Extended Properties must be used.
In the past we used something like this.
/*
* NOTE: Auto-Generated Procedure DO NOT MODIFY
*/
CREATE PROCEDURE dbo.MyProc
AS
SELECT *
FROM MyTable
GO
T...
I have a table called student with two columns:
JoinDate DATE
EmployeeName STRING
The contents of the table are as follows:
EmployeeName | JoinDate
----------------+-----------------
jaison | 1-jan-2008
robin | 2-feb-2008
binoy | 3-mar-2008
rahul | 4-feb-2008
I am looking to prepare the fol...
What is the most efficient way to select the first and last element only, from a column in SQLite?
Thanks.
...
I am selecting from a database of news articles, and I'd prefer to do it all in one query if possible. In the results, I need a sorting criteria that applies ONLY to the first result.
In my case, the first result must have an image, but the others should be sorted without caring about their image status.
Is this something I can do with...
I have an update statement which updates a table. And there is a column records the last modified time. If the row data has not been changed, I don't want to change the last modified date time.
What is the best way to check whether an update statement will change the row of data or not.
Thanks,
...
I am working in SQL 2005 (I think), SQL Query Analyzer Version SQL 8.00.760.
I would like to write a query that returns a count into a Crystal Report from a table only if the due date exceeds 14 days based on the end date in the report search. Based on my very limited understanding of SQL, I have come up with the following, which has p...
I have a table in a MySQL database defined similar to the following:
CREATE TABLE doc_types (
id INT UNSIGNED PRIMARY KEY,
types SET('foo','bar','baz','quux',...) NOT NULL
)
I would like to get the value of the types column as a comma-separated list of 1-based integer offsets into that list of set values, e.g. "1,3,4" for a...
void max_min(sqlite3 *db)
{
//call back*********
int i, ncols;
sqlite3_stmt *stmt;
char *sql;
const char *tail;
char *zErrMsg = 0;
int rc;
//******************
//min/max variables
char min[20];
char max[20];
//we want only the min and max value of this table
sql = "SELECT MIN(Start...
Further to my earlier question. Now I have two different queries that work. The first query returns a result of 5092 and the second returns a result of 1885 adding up to 6977. I would like to combine them into one query to return a result of 6977. How can I make one query count the number of conditionassessmentdates that are active, ...
I am looking to fileupload a picture jpeg,gif,etc into an SQL database on an updateprofilepicture page. Then on the profile page, I want to retrieve the image from an sql database and have it show up in an Asp:Image control. I have much code trying to do this and it doesn't work. The table contains a column of type Image.
...
I'm performing a regular expression match on a column of type "character varying(256)" in postresql 8.3.3. The column currently has no indices. I'd like to improve the performance of this query if I can.
Will adding an index help? Are there other things I can try to help improve performance?
...
I'm getting the error below when calling a simple SP from the Rational Application Developer Data Perspective when connecting to a DB2 DB instance running on z/OS. Also when calling from SQuirreL. Straight SQL queries run no problem. The query also works fine when called from my JAVA code.
'Error: [ibm][db2][jcc][10243][10940] Stri...