| Author |
Topic |
|
Cyanider
Starting Member
7 Posts |
Posted - 2004-10-26 : 10:19:36
|
I want to do this:SELECT Cod_radicado, Tipo_registro, Ano_radicado, Fecha_creacion, Fecha_gestion, Elaborador, (u.Nombres + ' ' + u.Apellidos) AS Remitentes, (us.Nombres + ' ' + us.Apellidos) AS Corresponsales, Referencia, Guia, Enviado, Flag, Anulado FROM datosdocumento, usuarios u, usuarios us WHERE Tipo_registro = 'ME' AND u.Codigo_usuario = CONVERT(int, Remitente) AND us.Codigo_usuario = CONVERT(int, Corresponsal)UNIONSELECT Cod_radicado, Tipo_registro, Ano_radicado, Fecha_creacion, Fecha_gestion, Elaborador, (u.Nombres + ' ' + u.Apellidos) AS Remitentes, Nombre_corresponsal AS Corresponsales, Referencia, Guia, Enviado, Flag, Anulado FROM datosdocumento, usuarios u, corresponsales WHERE Tipo_registro <> 'ME' AND u.Codigo_usuario = CONVERT(int, Remitente) AND Codigo_corresponsal = CONVERT(int, Corresponsal)But the column 'Referencia' its a text datatype.How can i join this 2 queries showing the text column data ?¿?Plz help  |
|
|
surefooted
Posting Yak Master
188 Posts |
Posted - 2004-10-26 : 10:29:17
|
I think it may be trying to eliminate dupliates with just the union operator kind of like a distinct. Blob fields like Text nText and Image can be too large for SQL to compare for a distinct-like clause. Try using union all. That should return what you need.SELECT Cod_radicado, Tipo_registro, Ano_radicado, Fecha_creacion, Fecha_gestion,Elaborador, (u.Nombres + ' ' + u.Apellidos) AS Remitentes, (us.Nombres + ' ' + us.Apellidos) AS Corresponsales,Referencia, Guia, Enviado, Flag, Anulado FROM datosdocumento, usuarios u, usuarios us WHERE Tipo_registro = 'ME' AND u.Codigo_usuario = CONVERT(int, Remitente) AND us.Codigo_usuario = CONVERT(int, Corresponsal)UNION ALLSELECT Cod_radicado, Tipo_registro, Ano_radicado, Fecha_creacion, Fecha_gestion,Elaborador, (u.Nombres + ' ' + u.Apellidos) AS Remitentes, Nombre_corresponsal AS Corresponsales,Referencia, Guia, Enviado, Flag, Anulado FROM datosdocumento, usuarios u, corresponsales WHERE Tipo_registro <> 'ME' AND u.Codigo_usuario = CONVERT(int, Remitente) AND Codigo_corresponsal = CONVERT(int, Corresponsal) -JonShould still be a "Starting Member" . |
 |
|
|
Cyanider
Starting Member
7 Posts |
Posted - 2004-10-26 : 10:46:19
|
| OMG i'm a dvmb4$$, UNION ALL was the key, very thanks to you and your wang.And if u wonder, yes, i'm 2n00b2bhere :( |
 |
|
|
|
|
|