July 2, 2008 at 4:07 pm
My SQL is this:
SELECT DISTINCT Pruebas.*,Metodos.* FROM Metodos, (Pruebas INNER JOIN Sinonimos ON Pruebas.NumPrue = Sinonimos.NumPrue) WHERE (Pruebas.EXCLUYE = 0) AND ((Pruebas.NOMPRUE LIKE '%Shometing%') OR (Sinonimos.NOMPRUE LIKE '%Shometing%')) AND (Metodos.CVEMETO=Pruebas.CVEMETO AND Metodos.DESMETO='RADIOLOGIA DIGITAL') ORDER BY Pruebas.NOMPRUE
I need select Pruebas where are have strign "Something" in Pruebas or have string "Someting" in Sinonimos and are of RADIOLOGIA DIGITAL
I try with LEFT JOIN but i get error in my SQL sintaxis.
July 2, 2008 at 4:13 pm
I'm not quite sure I'm following you here. It would help if you would post some sample data and an example of the result set that you are after based off of that sample data. Here is an article that has pointers for creating a thread so that you're more likely to get the help you need:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 3, 2008 at 7:35 am
Here is an untested attempt at cleaning up the SQL you provided to do what I thought you were trying to do.
SELECT DISTINCT Pruebas.*,Metodos.*
FROM (Metodos
INNER JOIN Pruebas
ON Metodos.CVEMETO=Pruebas.CVEMETO
AND Metodos.DESMETO='RADIOLOGIA DIGITAL'
AND Pruebas.EXCLUYE = 0)
LEFT OUTER JOIN Sinonimos
ON Pruebas.NumPrue = Sinonimos.NumPrue
WHERE Pruebas.NOMPRUE LIKE '%Shometing%'
OR Sinonimos.NOMPRUE LIKE '%Shometing%'
ORDER BY Pruebas.NOMPRUE
If it was easy, everybody would be doing it!;)
July 3, 2008 at 9:59 am
Thanks SSCrazy and SSC Veteran.
I going to review the articule SSCrazy.
SSC Veteran I try the SQL setences but don't work me.
This SQL sentences is to Access I don't know if this is important, the error display is:
"The expression of this combination is not permitted"
:unsure:
July 3, 2008 at 12:16 pm
HI,
it would be great if you can post some sample data and your requriement so that we can help you in writing the right query.
Thanks - Vj
July 3, 2008 at 1:42 pm
hi Vj
Ok, example:
Table Pruebas Table Sinonimos Table Metodo
NumPrue NomPrue Cvemeto id NumPrue NomPrue CVEMETO DESMETO
1 EGORINE 1 1 1 ORINE 1 RADIOLOGIA DIGITAL
2 HAND RDX 1 2 1 GENERAL ORINE
3 2 Ray X
3 AIDS 2
Ok, I want searh all "Pruebas" that are "Metodo" be "RADIOLOGIA DIGITAL" but that search a string example "ORINE" display:
1, ORINE
2, GENERAL ORINE
3, EGORINE
July 3, 2008 at 1:54 pm
OK, we're getting closer but I still can't make anything out of your example because the formatting (and language barrier) makes it difficult to know which columns/values go with each table. This is why I encouraged you to read the thread on how to post a well formatted question. I would like to see your example data posted in the following format so that I can make sense out of it.
DECLARE @Pruebas TABLE (column defs here)
DECLARE @Sinonimos TABLE ( column defs here)
DECLARE @Metodo TABLE (column defs here )
INSERT INTO @Pruebas
SELECT Sample data here UNION ALL
SELECT
INSERT INTO @Sinonimos
SELECT Sample data here UNION ALL
SELECT
INSERT INTO @Metodo
SELECT Sample data here UNION ALL
SELECT
Example Result Set:
ColumnName ColumnName2
1 ORINE
2 GENERAL ORINE
3 EGORINE
July 7, 2008 at 4:34 pm
Thank's for all.
I resolved my problem.
July 8, 2008 at 8:44 am
Would you mind formatting and posting your solution so that others who come across this thread have the benefit of seeing the solution?
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply