skcvasanth
Programmer
Hi, I'm working on a application program where I need to use where in function to include my literals which are received during run time. Assume below is my table.
Table name : Master
SEQ_NO NAME
1 XXXX
2 YYYY
1 ZZZZ
My queries are..
The literals will change based on the need.
select * from master where seq_no in(1,2)
This query is returning just 3 rows which seems to be OK and I don't have questions on that.
select * from master where seq_no in(1,1)
This query is returning just 2 rows. It makes sense because only 2 rows are available. I'm using DB2 and the question is how DB2 decides it's the same row and eliminates the second literal and not returning 4 same rows ? if the literals are same, it just ignores the 2nd one ?
select * from master where seq_no in(2,2)
This query is returning just 1 row. It makes sense because only 1 row is available. I'm using DB2 and the question is.. how DB2 decides it's the same row and eliminates the second literal and not returning 2 same rows ? if the literals are same, it just ignores the 2nd one ?
Thanks for your help in Advance!
CVR
Table name : Master
SEQ_NO NAME
1 XXXX
2 YYYY
1 ZZZZ
My queries are..
The literals will change based on the need.
select * from master where seq_no in(1,2)
This query is returning just 3 rows which seems to be OK and I don't have questions on that.
select * from master where seq_no in(1,1)
This query is returning just 2 rows. It makes sense because only 2 rows are available. I'm using DB2 and the question is how DB2 decides it's the same row and eliminates the second literal and not returning 4 same rows ? if the literals are same, it just ignores the 2nd one ?
select * from master where seq_no in(2,2)
This query is returning just 1 row. It makes sense because only 1 row is available. I'm using DB2 and the question is.. how DB2 decides it's the same row and eliminates the second literal and not returning 2 same rows ? if the literals are same, it just ignores the 2nd one ?
Thanks for your help in Advance!
CVR