[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Giorgio

3/19/2007 12:39:00 PM

Can someone tell me options to do this statment because this one does
not work!

SELECT Name FROM tbl_J
WHERE J_ID IN
(SELECT J1, J2, J3, J4, J5, J6
FROM tbl_CJ
WHERE CJ_ID =23515) ORDER BY Name

3 Answers

Robert Klemme

3/19/2007 12:51:00 PM

0

On 19.03.2007 13:39, Giorgio wrote:
> Can someone tell me options to do this statment because this one does
> not work!
>
> SELECT Name FROM tbl_J
> WHERE J_ID IN
> (SELECT J1, J2, J3, J4, J5, J6
> FROM tbl_CJ
> WHERE CJ_ID =23515) ORDER BY Name
>

Use a join.

robert

Roy Harvey

3/19/2007 12:52:00 PM

0

There are a number of ways to do this, but most become long and
complicated. This may be the simplest.

SELECT Name
FROM tbl_J as A
WHERE EXISTS
(SELECT * FROM tbl_CJ as B
WHERE B.CJ_ID = 23515
AND A.J_ID IN
(B.J1, B.J2, B.J3,
B.J4, B.J5, B.J6))
ORDER BY Name

Roy Harvey
Beacon Falls, CT

On 19 Mar 2007 05:39:00 -0700, "Giorgio" <FJMartinho@googlemail.com>
wrote:

>Can someone tell me options to do this statment because this one does
>not work!
>
>SELECT Name FROM tbl_J
>WHERE J_ID IN
>(SELECT J1, J2, J3, J4, J5, J6
>FROM tbl_CJ
>WHERE CJ_ID =23515) ORDER BY Name

--CELKO--

3/19/2007 2:09:00 PM

0

>> Can someone tell me options to do this statment because this one does not work! <<

You are comparing a scalar, j_id to an entire row, (j1, j2, j3, j4,
j5, j6) and this makes no sense.

What were you trying to do?