Select distinct (field) from [@tab]
Hello,
*i tried select with distinct query in SDK but it id not working... how we will use this functionality in SDK but same query
working fine in SQL server*
By
Firos.C
Why can we not use DISTINCT?
Rune
Similar Messages
-
Select Distinct Fields from non related table
Hi Experts,
I have to fetch Distinct Fields from table zdcxy along with the fields from the table zvend but there is no primary key forigen key relationship also if I wanted use join condition. I need to move fields from both the table into output file and 1 part I implemented but I am unable to do second part plz any body can help me its argent. below I pasted part of code along with two requirements.
1.Select all data (Location - LIFNR, Descr u2013 ZPLTNAMEC, CJI_CUSTOMER u2013 CJI customer flag) from ZVEND table.
2.Select all distinct DCs and BUs from zdcxy table.
SELECT * FROM ZVENDPLT INTO CORRESPONDING FIELDS OF TABLE IT_VENDPLT.
*select distinct zdc from zdcxy into corresponding fields of table it_map.
*select distinct zbu from zdcxy into corresponding fields of table it_map.
IF SY-SUBRC = 0.
LOOP AT IT_VEND.
MOVE : IT_VENDPLT-LIFNR TO IT_TAB-FIELD1,
IT_VENDPLT-ZPLTNAMEC TO IT_TAB-FIELD2,
IT_VENDPLT-CJI_CUSTOMER TO IT_TAB-FIELD3,
CONCATENATE :IiT_TAB-FIELD1 IT_TAB-FIELD2 IT_TAB-FIELD3 IT_TAB-FIELD4
INTO IT_LOAD-RECORD SEPARATED BY SEPARATOR.
TRANSFER IT_LOAD TO OUT_FILE.
ENDLOOP.
Can any body explain me hw to fetch DC and Bu from the table zdcxy and keep in the same loop of it_vend.
Second thing is that I need to give information about records into second output file hw to do that means I opened one more file and I am unable to move the record history there plz help me.
Thanks in advancePlz any body can help me it's argent.
Thanks
Basu -
Need of SQL query in selecting distinct values from two tables
hi,
I need a query for selecting distinct values from two tables with one condition.
for eg:
there are two tables a & b.
in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
can anybody please help me.
Thanks in advance,
RatheeshNot sure what you mean either, but perhaps this will start a dialog:
SELECT DISTINCT a.empno,
a.name,
a.sex,
b.salary,
b.doj
FROM a,
b
WHERE a.empno = b.empno;Greg -
Selecting desired fields from extract structure to datasource in CRM
hi guys... coming back to this forum with new problem...
how are you guys...
i'm using ds 0CRM_SALES_ACT_1 in CRM to extract activities related data...
by standard this data source is not supplying some fields which i needed... but when i checked in 'roosfield' table and even in extract structure 'CRMT_BW_DS_ACTIVITY' it is showing the those fields which i required...
how can i get these fields to data source...
in LO its like...we can select required field from extract sturcture right???
is there any procedure do same with CRM data sources...
thnaking you...
regards...
nithin
Message was edited by: nith lHi,
If the fields are available in ES but not available in DS , then we can Modify the table ROOSFIELD. But, I think, this is some what rude mothod.
Before doing this, It is better to Raise a OSS. They may come out with some SP upgradation.
Search this forum with ROOSFIELD.
With rgds,
Anil Kumar Sharma .P -
How to select distinct values from a table when it has composite primary ke
Hi
I have the requirement like , I need to select distinct one column values from the table which has composite primary key. How to acheive this functioinality using view object.
Eg : Table 1 has col1 and col2, col3
col1 col2 col3
1 A NA
1 B NA
2 A NA
3 C NA
2 D NA
primary key (col1,col2)
I have to select distinct col1.
ThanksHi
I got the solution for above. By Creating the read only view object we can acheive this.
thanks -
Use of selection, inversion & field only tabs in datasource
Hi,
What is the use of the tab
selection, inversion & field only know in customer exit
in datasource.
Also is there any other use of hide tab except unhiding it to reflect in BI system.
Thanks,
Shamkant.Got on own
-
Dear all experts,
I am able to populate all fields data from database table, using dynamic table creation.
eg,
SELECT * FROM (w_tabname) INTO TABLE <t_itab>.
where w_tabname is the table name given by the user, and t_itab is field symbol.
but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
<b>I can</b> take those fields from file into any internal table,
but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
i have tried with field symbol, it is not working (as per my knowledge.)
do i need to create any structures dynamically ?
Can anybody please help in this regards ?
Your help will be surely rewarded with points.
Waiting for reply..
Regards
VinayHi Vinay ,
Adding to the below code , you can use some more fields in the select stmt as below:-
REPORT ychatest.
PARAMETERS : p_field1 LIKE dd03l-fieldname,
P_field2 LIKE dd03l-fieldname,
p_table LIKE dd03l-tabname.
FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
Now p_field1 & p_field2 belong to the same table since you have give the user to enter only one table name.
This should work fine.
please try & let me know .
Thanks & Regards,
Daniel -
Selecting Multiple fields from fillable form in Adobe Reader
I created a form in Adobe Pro, and want to be able to select multiple fields to cut and paste the results in other parts of the form.
Does anyone know of a way to do this?
I would appreciate any help! ThankyouGo to Form Edit mode, and then you can select multiple fields either in the Fields list, or on the page itself (using Ctrl), or by holding down the mouse and dragging the selection square over them. Then just Ctrl+C and Ctrl+V in the other page, and you'll get copies.
Edit: This can only be done in Acrobat, though. Your title talks about Reader but you post is about Acrobat... -
Select Distinct rows from 3 tables
I need to retrive information from 3 different tables by applying a specific condition.
I have the following query which works fine for retrieving desired data from 2 tables.
SELECT
a.userId
FROM userGeneral
a inner
join userSpecific
b on a.userId
= b.userId
WHERE
a.userActive
= 1
userId
111
222
333
444
Now I have a third table called userMgr which may contain multiple records for each userId with a corresponding mgrId value. It has a primary key identity column called userRecId and I would like to fetch the
mgrId value corresponding to the MAX(userRecId) for the matching userId.
userRecId | userId | mgrId
1 | 111 | 123
2 | 111 | 234
3 | 111 | 345
4 | 333 | 345
5 | 333 | 456
The resultset should be as follows after joining all the 3 tables.
userId | mgrId
111 | 345
222 | NULL
333 | 456
444 | NULL
Can anyone please help with this query.I need to retrive information from 3 different tables by applying a specific condition.
I have the following query which works fine for retrieving desired data from 2 tables.
SELECT
a.userId
FROM userGeneral
a inner
join userSpecific
b on a.userId
= b.userId
WHERE
a.userActive
= 1
userId
111
222
333
444
Now I have a third table called userMgr which may contain multiple records for each userId with a corresponding mgrId value. It has a primary key identity column called userRecId and I would like to fetch the
mgrId value corresponding to the MAX(userRecId) for the matching userId.
userRecId | userId | mgrId
1 | 111 | 123
2 | 111 | 234
3 | 111 | 345
4 | 333 | 345
5 | 333 | 456
The resultset should be as follows after joining all the 3 tables.
userId | mgrId
111 | 345
222 | NULL
333 | 456
444 | NULL
Can anyone please help with this query.
try this:
select userId,userRecId,
from userMgr,
(SELECT a.userId, max(a.userRecId)
FROM userGeneral a inner join userSpecific b on a.userId = b.userId
group by a.userId
WHERE a.userActive = 1) table1(userId,userRecId)
where userMgr.userRecId = table1.userRecId -
Select Distinct rows from multiple tables
Table 1 is a List of Vendors - VID, PID, VName, VAddress, VPhone
Table 2 is a list of Products - PID, PName, PPrice, PWeight, PColor
I need to produce a list of unique PID's showing the following fields - PID, VName, PName, PColor
So, Here is my failed attempt:
SELECT P.PID, V.VName, P.PName, P.PColor
FROM Products P INNER JOIN Vendors V ON P.PID = V.PID
GROUP BY P.PIDIf you post DDL, sample data and your desired output based on that sample data, someone can probably create a query that does what you want.
And I have to tell you that Table 1 is not a list of vendors unless you have a system where a vendor provides one and only one product - something that is unusual. If your system is one where a vendor should provide any number of products (and if a product
can be provided by any number of vendors), you have some fundamental schema issues to correct.
Lastly, there are sticky posts at the top of the forum that provide suggestions for posting questions. Please have a look - help your readers help you by providing sufficient information. Phrases such as "failed" or "does not work"
do not provide any useful detail. And one good rule of thumb - any time you feel you need to use (or say) distinct in a query is an indication that something somewhere is wrong. It could be a schema issue, a misunderstanding of the schema or the
goal, an incorrect query, etc. There are few instances where distinct is needed in a well-defined and implemented system, IMO. -
How to select a field from view
Hai All
This is my view name mtl_item_flexfields mif
i can able to select a single column Ie Inventory_item from view when i use this
Select inventory_item from mtl_item_flexfields mif.
But i not able get the values when i use this select statement
SELECT organization_code,
item_number,
mif.organization_id,
COUNT(*)
FROM mtl_item_flexfields mif,
mtl_parameters mp
WHERE mif.organization_id = mp.organization_id
AND mif.organization_id IN (87,85)
GROUP BY organization_code,
item_number,
mif.organization_id
HAVING COUNT(*) > 1
ORDER BY 1,2;
Thanks & Regards
SrikkanthHello Srikkanth,
The query you posted cannot return the inventory_item column because that column isn't part of you GROUP BY clause.
If you need to see the inventory_item column, you should either include it in your GROUP BY clause (but I doubt that's the right thing to do in this case) or, you need to apply an aggregation function to the inventory_item column, such as MAX or MIN (this may be appropriate in this case but, without seeing any data, can't really tell).
The GROUP BY limits the fields you can select to be either, included in the GROUP BY clause or, arguments of an aggregation function whose result is driven by the GROUP BY clause. In any other case, you'll get message complaining about the field not being part of a group by group.
HTH,
John.
P.S: put code (like the select you posted) and data enclosed in [ code ] <your code here> [ / code ]
(without the spaces), that will format the code nicely, like this
nicely formatted code herewhich makes it much easier to understand.
Edited by: 440bx - 11gR2 on Aug 13, 2010 5:44 AM - added "" suggestion -
Getting Error while trying to select SS function from Tab(HTMl Tab on OAF)
Hi All,
I was trying to create a TAb navigation for the Self Service functions.
There are 3 4 functions (Transactions) all other are working fine while I am trying to navigate via tabs.
But there is a seeded SS function "Home Contac"(HR_PERINFO_SS) this is not working giving me error as
"The selected action is not available. The cause may be related to security. Contact your system administrator to verify your permission level for this action."
when I am directly hit the function link from Menu its working fine but via tab its giving error.
Below is the function description
Web HTML :
OA.jsp?akRegionCode=HR_CREATE_PROCESS_TOP_SS&akRegionApplicationId=800&OAHP=XX_MSS_HOME_PAGE&OASF=XX_ESS_HOME_CONTACTS&OAFunc=GE_ESS_HOME_CONTACTS&GEHomeContact=Y
Parameter:
&pProcessName=XX_PERSONAL_INFO_JSP_PRC&pItemType=HRSSA&pCalledFrom=HR_PERINFO_SS&pPersonID=&pFromMenu=Y
Please let me know how can correct this.
Thanks,
TarunHi,
Please refer the last reply of following post:
NWDI Configuration
I hope it will help u out.
Can refer this help link too.
http://help.sap.com/saphelp_nw04s/helpdata/en/03/f6bc3d42f46c33e10000000a11405a/frameset.htm -
Selecting structure fields from search box in expressions and rules.
Hi,
I've a case where there are more than one structure object (structures bound to DDIC structure) with same field (lets say MATNR for example). Now assume that I've 5 structures with the field MATNR (struct_1, struct_2,... struct_5). I've to use the field struct_3-MATNR in one of the expressions are result object. So I click on the context menu button of the result link and click on Select... menu option. In the pop up search screen I type MATNR and it shows me 5 result records. Now the problem is how do I know which MATNR belongs to struct_3. The search results doesn't show to which structure &/OR table a field belongs to.
I've been randomly selecting each one till I get the right one which wastes a lot of time.I'll try to put my case with a more detailed explanation.
Hierarchy:
Function_01->Ruleset_01->Ruleset_exp_01(DB_LOOKUP)
In the above DB_LOOKUP I try to fetch records from database based on VBELN.
I've a structure Struct_01 in the Function_01 context with the element VBELN in it(Struct_01).
My select query goes like this.
Select Col1 Col2 Col3 from XYZ_TABLE WHERE VBELN = Struct_01-VBELN.
I've to select Struct_01-VBELN for the above case, but I don't find Struct_01 though it is in the function context.
Note: I've around 5 structures with VBELN -
Selection-screen (field from .Include structure)
Hi all,
I have a selection screen with several select-options. One of the select-option is
select-options: s_vornr for afvc-vornr.
Where 'vornr' is a .Include structure field in the table 'afvc'. Now my question is, in selection screen when I click on the box for this particular select-option I dont see the circle(from where we can select the existing input values) at the end of the box.
Why is it so and how can get that circle option at the end of the box by sticking to the same table and field(afvc-vornr).
Waiting for your help.
Thankshi,
the field do not have nay value range with it.
you can put the F4 help by using
At Selection-Screen on Value-request <select-option>. event.
e.g.
DATA : rt_values TYPE STANDARD TABLE OF type_values,
rs_values TYPE type_values,
rt_fields TYPE STANDARD TABLE OF type_fields,
rs_fields TYPE type_fields.
CLEAR : rs_values,rs_fields.
REFRESH : rt_values,rt_fields.
Creation of selection list
rs_fields-tabname = 'AFVC'.
rs_fields-fieldname = 'VORNR
rs_fields-selectflag = ' '.
APPEND rs_fields TO rt_fields.
SELECT vornr form AFVC
INTO TABLE t_vornr.
SORT t_vornr.
DELETE ADJACENT DUPLICATES FROM t_vornr.
LOOP AT t_vornr INTO s_vornr.
rs_values = s_vornr-vornr.
APPEND rs_values TO rt_values.
CLEAR rs_values.
ENDLOOP.
FUNCTION 'HELP_VALUES_GET_WITH_TABLE' EXPORTING
fieldname = 'AFVC'
tabname = 'VORNR
titel = 'Counting
IMPORTING
select_value = <select-opion>
TABLES
fields = rt_fields
valuetab = rt_values.
amit
Message was edited by: Amit Khare -
Select first field from column in group value
Hello,
I need to return the first row of data grouped by the first field (Visit ID) in multi-column table:
VisitID AdmitDate Unit Room OrderCode
001041 2014-08-01 2E 202 SWCC
001041 2014-08-01 2E 202 NULL
006811 2014-08-01 2E 204 SWCC
008815 2014-08-01 2E 206 NULL
004895 2014-08-01 2E 207 SWFA
004895 2014-08-01 2E 207 SWCC
004895 2014-08-01 2E 207 NULL
To return:
001041 2014-08-01 2E 202 SWCC
006811 2014-08-01 2E 204 SWCC
008815 2014-08-01 2E 206 NULL
004895 2014-08-01 2E 207 SWFA
I currently have a group by clause with all field names; and have tried max on the OrderCode in the select that doesn't work, and FIRST isn't recognized in SSL server. Do I need a subquery (if so, how as I'm newer to writing SQL) or what is another
solution? Thank you.create table t (VisitID varchar(50), AdmitDate date, Unit varchar(50),Room varchar(50),OrderCode varchar(50))
insert into t values ('001041' , '2014-08-01' , '2E' , 202 , 'SWCC' ),
('001041', '2014-08-01' , '2E' , 202 , NULL),
('006811' , '2014-08-01' , '2E' , 204 , 'SWCC'),
('008815' , '2014-08-01' , '2E' , 206 , NULL),
('004895' , '2014-08-01' , '2E' , 207 , 'SWFA'),
('004895' , '2014-08-01' , '2E' , 207 , 'SWCC'),
('004895' , '2014-08-01' , '2E' , 207 , NULL)
--To return:
--001041 2014-08-01 2E 202 'SWCC'
--006811 2014-08-01 2E 204 'SWCC'
--008815 2014-08-01 2E 206 NULL
--004895 2014-08-01 2E 207 'SWFA'
select VisitID,AdmitDate,Unit,Room , max(OrderCode) as OrderCode from t
group by VisitID,AdmitDate,Unit,Room
Order by VisitID
--Or
select VisitID,AdmitDate,Unit,Room ,OrderCode from (
select VisitID,AdmitDate,Unit,Room ,OrderCode, Row_number() Over(Partition By VisitID Order by OrderCode DESC) rn from t
)t
WHERE rn=1
Order by VisitID
drop table t
Maybe you are looking for
-
Document Splitting Error (GLT0002) while clearing Vendor line items by using F-44
Dear Guru's, My client is getting below error while clearing the vendor using T code F-44, I checked related links but i could not find the suitable solution for this issue. Doc No: 35112789 has the problem.. i checked Document splitting related Conf
-
Why aren't my contacts showing up in text messages or the call list?
I sync my iphone only with my exchange contacts. It was workng fine until yesterday. My contacts list show up in the contacts app with the correct names, but the text messages and missed calls/voicemail list only shows numbers... not showing contact
-
Why can't I clear my browsing history in safari
I am trying to clear my browsing history on my iPhone 4 but the bit ton is gray and won't allow me to select it in either the settings menu or in the actual browser. I also tries putting my safari app into private mode but for some reason cannot fin
-
Hi, first of all, though it sounds similar this question is completely different to and independent from the "former question" (MaxDB: Table with many LONG fields does not allow an INSERT: ...?) I posted a few hours ago. The "former question" refers
-
Hi all, What is Work center hierachy? what is the Purpose of creating work center Hierachy?