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

regarding performance in select query

Former Member
0 Likes
666

hi to all,

i wrote select query for fetching duplicate records,like select distinct *.

so at runtime it fetches all fields in table (FI dbtable).

but i want to fetch only 8 records,for this i am using

select distinct

field1

field2

..... like this ,it wasnt excuted.

how can i avoid this issue.

in program not much logic is there,only fetching the data and summation,n display.....

plz giv me reply asap.

regards

satya

6 REPLIES 6
Read only

Former Member
0 Likes
645

>

> hi to all,

>

> i wrote select query for fetching duplicate records,like select distinct *.

> so at runtime it fetches all fields in table (FI dbtable).

>

> but i want to fetch only 8 records,for this i am using

> select distinct

> field1

> field2

> ..... like this ,it wasnt excuted.

>

> how can i avoid this issue.

> in program not much logic is there,only fetching the data and summation,n display.....

>

> plz giv me reply asap.

>

> regards

> satya

Hi,

write like this

> select field1

> field2

> .......

> from table

> into ( itab-f1,

> itab-f2,

> ........ )

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 19, 2008 5:14 PM

Read only

Former Member
0 Likes
645

hi,

write this way...

select field1 field2

from zXX

into corresponding fields of itab.

Regards,

Anil.

Read only

Former Member
0 Likes
645

Hi,

Syntax

SELECT [SINGLE]|[DISTINCT]

  • | <si> [AS <a i>]... <agg>( [DISTINCT] <s j>) [AS <a j>]...

The selection can be one line, SINGLE, or several lines. You can eliminate duplicate lines using the DISTINCT addition. To select the entire line, use *, otherwise, you can specify individual columns <si>. For individual columns, you can use aggregate functions <agg>, and assign alternative column names <a i>.

Regards,

Bhaskar

Read only

Former Member
0 Likes
645

Hi,

There are so many ways for improve the performance of your report like as follows

1) The select statement which you are written it should follow the index other wise it will take time to get the data from the database

2) Use the sequence of the fields what you are selecting

3) Use the count procedure when you are getting the more no pf records

many more.......

regards,

Madan.k

Read only

Former Member
0 Likes
645

Hi,


SELECT field1
       field2
       field3
       field4
INTO CORRESPONDING FIELDS OF itab
WHERE <conditions>

this will solve your porblem.

regards,

teja

Read only

Former Member
0 Likes
645

WRITE THE QUERY AS

SELECT F1 F2 F3

FROM TABLE_NAME

INTO TABLE ITAB

WHERE CONDITION.

DO NOT USE DISTINCT. IT LOADS ON DATABASE.

TO AVOID DUPLICATES, SORT THE itab AND THEN USE

DELETE ADJACENT DUPLICATES FROM ITAB

Narendra