Click here to Skip to main content
15,886,919 members
Home / Discussions / Database
   

Database

 
AnswerRe: using @@IDENTITY (or nething like this)for char datatype(sql server) Pin
utsav_verma19-Sep-05 0:22
utsav_verma19-Sep-05 0:22 
GeneralRe: using @@IDENTITY (or nething like this)for char datatype(sql server) Pin
enjoycrack19-Sep-05 0:51
enjoycrack19-Sep-05 0:51 
QuestionMultiple Choice Pin
Leslie Sanford18-Sep-05 19:25
Leslie Sanford18-Sep-05 19:25 
AnswerRe: Multiple Choice Pin
Colin Angus Mackay18-Sep-05 20:26
Colin Angus Mackay18-Sep-05 20:26 
GeneralRe: Multiple Choice Pin
Leslie Sanford19-Sep-05 6:21
Leslie Sanford19-Sep-05 6:21 
AnswerRe: Multiple Choice Pin
Edbert P18-Sep-05 20:31
Edbert P18-Sep-05 20:31 
QuestionSQL union Pin
phokojoe18-Sep-05 5:31
phokojoe18-Sep-05 5:31 
AnswerRe: SQL union Pin
Colin Angus Mackay18-Sep-05 12:00
Colin Angus Mackay18-Sep-05 12:00 
You are unioning a different set of columns on the same table so it sees them as distinct. If you were unioning the same set of columns then it would remove the duplicate rows.

If you do not want the same row being represented twice then you need to put in a WHERE statement to each to define what is permitted and what isn't.

Alternatively you could perform two INSERT statements*. e.g.
INSERT INTO table2
SELECT [id], A11 AS A1, A12 AS A2, A13 AS A3
FROM table1
 
INSERT INTO table2
SELECT [id], A21 AS A1, A22 AS A2, A23 AS A3
FROM table1
RIGHT OUTER JOIN table2 ON table1.[id] = table2.[id]
WHERE table2.[id] IS NULL

However, you still need to define conditions as to what is acceptable and what isn't for these two inserts as the second INSERT will currently not add anything as each row will already be represented. Also, table2 needs a primary key that is shared with table1. I've assumed that to be a column called [id], you may need to change that.


* DISCLAIMER: I've not tested this so it may not be 100% correct. I tend to get my right and left outer joins mixed up




My: Blog | Photos

"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious


Questionmysql conncetion for absolute beginner Pin
Sasuko17-Sep-05 23:46
Sasuko17-Sep-05 23:46 
QuestionDatabase Error at Enterprise Manager Pin
YoungLearner17-Sep-05 22:32
YoungLearner17-Sep-05 22:32 
QuestionI NEED A QUERY SAMPLE IF POSSIBLE Pin
MAGICIANMERLIN17-Sep-05 11:10
MAGICIANMERLIN17-Sep-05 11:10 
AnswerRe: I NEED A QUERY SAMPLE IF POSSIBLE Pin
Colin Angus Mackay17-Sep-05 12:41
Colin Angus Mackay17-Sep-05 12:41 
GeneralRe: I NEED A QUERY SAMPLE IF POSSIBLE Pin
MAGICIANMERLIN18-Sep-05 2:07
MAGICIANMERLIN18-Sep-05 2:07 
QuestionMANIPULATING VIEWS Pin
Wisdom200417-Sep-05 3:53
Wisdom200417-Sep-05 3:53 
QuestionLike Query & Null Values Pin
rich_wenger16-Sep-05 12:08
rich_wenger16-Sep-05 12:08 
AnswerRe: Like Query & Null Values Pin
turbochimp16-Sep-05 17:39
turbochimp16-Sep-05 17:39 
GeneralRe: Like Query & Null Values Pin
rich_wenger17-Sep-05 1:18
rich_wenger17-Sep-05 1:18 
GeneralRe: Like Query & Null Values Pin
rich_wenger17-Sep-05 3:21
rich_wenger17-Sep-05 3:21 
GeneralRe: Like Query & Null Values Pin
turbochimp17-Sep-05 5:56
turbochimp17-Sep-05 5:56 
GeneralRe: Like Query & Null Values Pin
turbochimp17-Sep-05 5:36
turbochimp17-Sep-05 5:36 
GeneralRe: Like Query & Null Values Pin
rich_wenger18-Sep-05 14:49
rich_wenger18-Sep-05 14:49 
GeneralRe: Like Query & Null Values Pin
turbochimp18-Sep-05 18:06
turbochimp18-Sep-05 18:06 
AnswerRe: Like Query & Null Values Pin
Mike Dimmick17-Sep-05 10:43
Mike Dimmick17-Sep-05 10:43 
GeneralRe: Like Query & Null Values Pin
rich_wenger18-Sep-05 14:53
rich_wenger18-Sep-05 14:53 
Questionuse mySQL with c# applications Pin
Sasuko16-Sep-05 0:55
Sasuko16-Sep-05 0:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.