‎2009 Oct 14 1:26 PM
Hi all,
I have a select query scenario.
For example in a ztable
I have two fields A and B
it holds records like
A B
3 5
2 10
7 12
if my input is 4
I wrote a query like
select * from ztab where ( a <= input and b >= input ).
But its not working
The problem is its picking both the record
3 5
2 10
but my output should be
3 5
Hope its clear ..
I know that this could be acheived using a select and a delete from itab.
But i need to acheive this through single select.
Any ideas ..
‎2009 Oct 14 1:35 PM
Why 3 5 and whynot 2 10? on what basis you need 3 5? will that logic works with just select?
‎2009 Oct 14 1:35 PM
Why 3 5 and whynot 2 10? on what basis you need 3 5? will that logic works with just select?
‎2009 Oct 14 1:42 PM
Hi i'll explain with the real values
my input is 123456789011234
but its fetching
100000 199999
100000 199999
Hope its clear now.
Actually it must not pick any data.
‎2009 Oct 14 1:44 PM
‎2009 Oct 14 1:59 PM
Hi,
Just a hunch: are all three fields in your example (A, B, input) numeric ? If they are character fields, then the two fetched records nicely match your WHERE clause.
Rgds,
Mark
‎2009 Oct 14 2:05 PM
Yes you are right.
All three are of type c.
Me too was looking around this.
but after the select when i give
DELETE lt_cdv_params[] WHERE to_bankkey < input.
still it doesnt work.
hope so i should change the data type.
Any ways to do without changing the data type ?
‎2009 Oct 14 2:18 PM
Hi,
If the data comes from a Z table and the fields are numeric by nature (as the name "bankkey" might imply), then I would really recommend adapting the data type in the table, making the fields numeric. Working around the data type in your code (which technically you coudl do by a MOVE from the C field to a numeric field) would be clumsy and you'd have to do it in every program thet accesses this data.
Regards,
Mark
‎2009 Oct 14 2:27 PM
‎2009 Oct 14 1:46 PM
Hi,
Use SELECT SINGLE statement then you will get first record.
‎2009 Oct 14 1:50 PM
1)I cannot use select single , may contain multiple records.
2)Data types are same for both
Should i go for sub query ?