|
-
Mar 22nd, 2000, 10:22 PM
#1
Thread Starter
New Member
Hi,
I am trying to select a field with two different conditions in one SQL statement.
Some thing like this(dose not work)
select
acclst.acc_no as sacc_no, acclst.acc_no as lacc_no
from
acclst acclst
where
acclst.acc_type in(select acclst.acc_type from acclst where acclst.acc_type
= "L")and
acclst.acc_type in(select acclst.acc_type from acclst where acclst.acc_type
= "S")
If any one has suggestions please reply.
Thank you.
-
Mar 22nd, 2000, 11:41 PM
#2
Lively Member
I dont't think you can do what you are trying to do. You can create a stored procedure to return a recordset based on the acc_type. The execute the stored procedure twice once when acc_type = "L" and once when acc_type = "S". Or you can select acc_no and acc_type and loop through the recordset and process on the acc_type. It depends on what you are trying to do with the select.
-
Mar 23rd, 2000, 12:56 AM
#3
Guru
Why don't you do this?
select
acclst.acc_no as sacc_no, acclst.acc_no as lacc_no
from
acclst acclst
where
acclst.acc_type = "L" OR
acclst.acc_type = "S"
-
Mar 23rd, 2000, 02:26 AM
#4
Frenzied Member
Use Tom's SQL. Yours doesn't work because your query expects one field to have two values/record. acclst.acc_type cannot be "L" and "S", at the same time.
-
Mar 23rd, 2000, 07:19 AM
#5
Thread Starter
New Member
what is Tom's SQL?
Use Tom's SQL. Yours doesn't work because your query expects one field to have two values/record. acclst.acc_type cannot be "L" and "S", at the same time.
-
Mar 23rd, 2000, 10:25 AM
#6
Guru
Sorry! I am TOM. This is my code.
Why don't you do this?
select
acclst.acc_no as sacc_no, acclst.acc_no as lacc_no
from
acclst acclst
where
acclst.acc_type = "L" OR
acclst.acc_type = "S"
-
Mar 24th, 2000, 01:39 AM
#7
Frenzied Member
Suppose I should've said Clunietp.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|