Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select single vs distinct

Former Member
0 Likes
2,904

hi,

what is the difference for select single and select distinct?

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,482

Hi,

This is the difference between these two

<b>SELECT SINGLE</b>

<b>The result of the selection should be a single entry</b>. If it is not possible to identify a unique entry, the system uses the first line of the selection. If you use the FOR UPDATE addition, the selected entry is protected against parallel updates from other transactions until the next database commit (see LUW and database lock mechanism). If the database system identifies a deadlock, a runtime error occurs.

<b>SELECT DISTINCT</b>

Duplicate entries in the result set are automatically deleted. There can be multiple entry exist in database for WHERE condition.

Let me know if you need any other information.

Regards,

RS

3 REPLIES 3
Read only

Former Member
0 Likes
1,483

Hi,

This is the difference between these two

<b>SELECT SINGLE</b>

<b>The result of the selection should be a single entry</b>. If it is not possible to identify a unique entry, the system uses the first line of the selection. If you use the FOR UPDATE addition, the selected entry is protected against parallel updates from other transactions until the next database commit (see LUW and database lock mechanism). If the database system identifies a deadlock, a runtime error occurs.

<b>SELECT DISTINCT</b>

Duplicate entries in the result set are automatically deleted. There can be multiple entry exist in database for WHERE condition.

Let me know if you need any other information.

Regards,

RS

Read only

Former Member
0 Likes
1,482

select single statement is used to retrieve a single record by inputting all the combination of primary key as the search criteria. Here we retrieve a single unique record.

select distinct is used to retrieve a set of records satisfying the search criteria without any duplicate records. here you may not need to give the combination of primary key as search criteria.

Read only

Former Member
0 Likes
1,482

Hi,

Please reward appropriate point and close the thread. It is a way to say thanks in forum.

Regards,

RS