|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
two select statements on one table
Hi,
Im trying to perform the following two select statements on the one table. I have been trying innerjoins etc but keep getting errors. The basis of what im trying to do is this. SELECT column1 FROM table1 WHERE column2 = (select column2 from table1 where column3 = 14) Any ideas greatly appreciated. |
|
#2
|
|||
|
|||
|
It looks ok to me. What errors are you getting?
|
|
#3
|
|||
|
|||
|
error message
cheers for reply.
the error im getting is - Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. |
|
#4
|
|||
|
|||
|
Hi,
Try changing the = to an IN ,e.g. SELECT column1 FROM table1 WHERE column2 IN (select column2 from table1 where column3 = 14) Your original query worked here on my tables but i would normally use an IN on a sub-query. Barry |
|
#5
|
|||
|
|||
|
10 out of 10 for the brains of the operation.
works great. cheers. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > two select statements on one table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|