How to select rows whose one column contains some specific characters ?
These is a table say T1 with a column say C1
Let the field C1's values be:
row 1)DE/SPT/A/FWD
row 2)G/SPT/DE/DE/SPT
row 3)R/FWD/SPT/A/FWD/FWD
row 4)A/A/DE/SPT/FWD
row 5)FWD/SPT/E/DE/A
How to get only those rows whose C1 column contains FWD in last ?
We can solve this with the simple use of a wildcard:
select *
from t1
where c1 like '%FWD'
/Note that this query will execute a full table scan, because any index you may have on C1 will be ignored: indexes are organised on the leading characters.
cheers, APC
Similar Messages
-
How to suppress row when one column has zero using condition
Hi Experts,
How do I suppress row when one column has zero.
I read it is possible using conditions.
How ?
Thankyou.Check this
1. for Query Properties, go to the Display tab and Supress Zeros is "Active"
2. select the Structure, right-click, select Properties, then click "on" Also Use Zero Suppression for Structure Elements
http://help.sap.com/saphelp_nw04/helpdata/en/a4/dd3841d132d92be10000000a1550b0/frameset.htm
Hope it Helps
Chetan
@CP.. -
How to select rows with duplicate column values
hi,
i have a table property_details which has these 2 columns customerno and propertyno a customer can have many properties and property number has to be unique. but somehow these property number has been duplicated at an earlier stage so i have for a customer with many properties the same property number
how i will select such records whose asset numbers are the same
for ex
customer no property no
a1300 1
a1300 1
a1300 1
a2330 10
a2330 10
a2330 10
kindly suggest me a solutionthis example might be of help.
SQL> select * from employees;
YEAR EM NAME PO
2001 02 Scott 91
2001 02 Scott 01
2001 02 Scott 07
2001 03 Tom 81
2001 03 Tom 84
2001 03 Tom 87
6 rows selected.
SQL> select year, empcode, name, position,
2 row_number() over (partition by year, empcode, name
3 order by year, empcode, name, position) as rn
4 from employees;
YEAR EM NAME PO RN
2001 02 Scott 01 1
2001 02 Scott 07 2
2001 02 Scott 91 3
2001 03 Tom 81 1
2001 03 Tom 84 2
2001 03 Tom 87 3
6 rows selected.
SQL> Select year, empcode, name, position
2 From (Select year, empcode, name, position,
3 row_number() over (partition by year, empcode, name
4 order by year, empcode, name, position) as rn
5 From employees) emp
6 Where rn = 1;
YEAR EM NAME PO
2001 02 Scott 01
2001 03 Tom 81
SQL> -
How to select rows with Empty Column Entry
I am trying to select all rows with an empty column
select row1 from table where row2=' ';
Any suggestions. I tried a space and no space in between the ''.An (theoretical) argument could be made that an empty string is not NULL (uknown), however Oracle's SQL and PL/SQL engines make no such distinction for VARCHAR2 and CHAR data types. As stated, you must use NULL as the comparison.
Michael -
How to select rows with min value on a specific column
I have a query:
select
m.x1,
round (to_date (l.y1, 'mm/dd/yyyy HH:MI:SS AM') - m.x2, 0) as numofdays
from
table1 m,
table2 l
where
l.x3 = m.x3 and
to_date (l.y1, 'mm/dd/yyyy HH:MI:SS AM') >= TO_DATE('01012013','MMDDYYYY') and
and I got this result table:
x1 (ID)
numofdays
001
5
001
10
002
2
003
3
003
1
004
0
005
66
several ID's have multiple values on the second column, I want to have only distinct IDs with smallest "numofdays" like this:
x1 (ID)
numofdays
001
5
002
2
003
1
004
0
005
66
Any ideas?Hi,
The most general and versatile way is a Top-N Query:
WITH got_r_num AS
select
m.x1,
round (to_date (l.y1, 'mm/dd/yyyy HH:MI:SS AM') - m.x2, 0) as numofdays
, ROW_NUMBER () OVER ( PARTITION BY m.x1
ORDER BY to_date (l.y1, 'mm/dd/yyyy HH:MI:SS AM') - m.x2
) AS r_num
from
table1 m,
table2 l
where
l.x3 = m.x3 and
to_date (l.y1, 'mm/dd/yyyy HH:MI:SS AM') >= TO_DATE('01012013','MMDDYYYY') and
SELECT x1, numofdays
FROM got_r_num
WHERE r_num = 1
If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
Notice that the sub-query (got_r_num) is exactly what you posted, only with a new column (r_num) added to the SELECT clause. -
Returning two rows with one column containing only one place
Dear all;
I have a query that returns two rows similar to this below
ID PLACE PROGRAM
A NEWYORK PROGRAM A
A NEWYORK PROGRAM B
I would like this instead
ID PLACE PROGRAM
A NEWYORK PROGRAM A
PROGRAM B
All help is appreciated. Thank you.Edited by: user13328581 on Mar 22, 2011 11:52 AMuser13328581 wrote:
WOW...THanks a lot Solomon, I have never used partitions and row_number in such a manner...can you please explain your logic.Sure:
row_number() over(partition by id order by place,program)This will take all rows returned by the query andsplit them into buckets (partitions) by id. Inside each bucket it will order rows by place and program and assign them row numbers. So for each ID row number 1 will be row with first (alphabetically) place first programt. And this is the row where we want ID to show up. That is why we wrap the above analytic function in CASE statement which will do exactly that. Now:
row_number() over(partition by id,place order by program)does pretty much the same just bucket is ID and PLACE combination. So for each such combination we want to show only for the first (alphabetically) programt.
Now notice in ORDER BY clause I prefix ID and PLACE with table alias. You must do it since otherwise query alias ID and PLACE will take precedence resulting in wrong sort order (remember we nulled all ID and PLACE except for row number 1).
SY. -
How do I find that, a column contains only numeric characters ?
I want to search for all the column values which has some non numeric value.
This should work: you'll need to adjust it if the column exceeds 10 characters. You also may need to add permitted non-numerical characters i.e. <space>, <comma>, <decimal point>, <minus sign>, etc.
select col1
from my_table
where translate(col1, '1234567890' '**********') != substr('**********', 1, length(col1))rgds, APC -
How to select more than one row in a JTable swing adf adf?
how to select more than one row in a JTable swing adf adf?
// Allow selection to span one contiguous set of rows, visible columns, or block of cells
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
// Allow multiple selections of rows, visible columns, or cell blocks
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); -
Hello everyone,
I am developing an application (ALV OO) to select more than 1 column by row ( one ). This is an a holiday application so the idea is:
-One column will be the day, and the row will be the user.
So I am trying to select more than one day by user (that would be the row).
I am using the method set_table_for_first_display but when it shows the alv, doesn't let me to select more than one column with a click of the mouse.
Does anybody know if I can do this (select more than one column, by row) in somehow?
Please let me know if you need more clarification about this.
Thanks in advance
DiegoHi Diego,
it's all in the documentation.
set different selection modes through the value of the field u201CSEL_MODEu201D in the layout structure.
SPACE
same as 'B'
see 'B'
Default setting
'A'
Column and row selection
Multiple columns
Multiple rows
The user selects the rows through pushbuttons at the left border of the grid control.
'B'
Simple selection, list box
Multiple columns
Multiple rows
'C'
Multiple selection, list box
Multiple columns
Multiple rows
'D'
Cell selection
Multiple columns
Multiple rows
Any cells
The user selects the rows through pushbuttons at the left border of the grid control
Beyond setting this option, you can set u201CNO_ROWMARKu201D option to hide the mark column which is normally visible when the selection mode allows multiple row selection.
One point to notice here is that if you set your ALV Grid as to be editable, it may override your selection mode regardless of your layout settings.
This is from SDN Community Contribution "An Easy Reference for ALV Grid Control" By: Serdar ŞİMŞEKLER
Sorry, no link,. it's on my disk.
Regards,
Clemens -
How to select more than one slide on Keynote?
Please, someone knows how to select more than one slide on keynote for IPad?
// Allow selection to span one contiguous set of rows, visible columns, or block of cells
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
// Allow multiple selections of rows, visible columns, or cell blocks
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); -
Return the rows of the table where a column contains a specific value first
I want my query to return the rows of the table where a column contains a specific values first in a certain order, and then return the rest of the rows alphabetized.
For Example:
Country
ALBANIA
ARGENTINA
AUSTRALIA
CANADA
USA
Now i want USA and CANADA on top in that order and then other in alphabetized order.
Edited by: 986155 on Feb 4, 2013 11:12 PM986155 wrote:
If it is 2 then i can write a case... i want generalised one where may be around 5 or 6 mentioned should be in descending order at the top and remaining in ascending order there after.Computers tend not to work in 'generalized' ways... they require specifics.
If you store your "top" countries in a table you can then simply do something like...
SQL> ed
Wrote file afiedt.buf
1 with c as (select 'USA' country from dual union
2 select 'Germany' from dual union
3 select 'India' from dual union
4 select 'Australia' from dual union
5 select 'Japan' from dual union
6 select 'Canada' from dual union
7 select 'United Kingdom' from dual union
8 select 'France' from dual union
9 select 'Spain' from dual union
10 select 'Italy' from dual
11 )
12 ,t as (-- top countries
13 select 'USA' country from dual union
14 select 'United Kingdom' from dual union
15 select 'Canada' from dual
16 )
17 select c.country
18 from c left outer join t on (t.country = c.country)
19* ORDER BY t.country, c.country
SQL> /
COUNTRY
Canada
USA
United Kingdom
Australia
France
Germany
India
Italy
Japan
Spain
10 rows selected. -
OBIEE - How to selectively hide or disable columns on a dashboard prompt?
Hello! I need some help with OBIEE dashboard Prompts. Any help will be highly appreciated!
Question 1. How to selectively hide or disable columns on a dashboard prompt or the entire prompt? There seems to be no "hide" or "dsable" options on
prompts.
Question 2. How to synchronize 2 different prompts on the same dashboard?
The application is this: There are total of 2 tabs on a dashboard ("tab_1" and "tab_2"). Each tab uses different prompts ("pr_1" and "pr_2"), having just one first drop down column in common ("Product_id").
The desired functionality is this: user selects "Product_id" on the first tab's prompt, which filters its reports (on "Go") and also propagates to the second tab. When user clicks on the second tab, the reports there are already filtered (or begin filtering) by "product_id", selected on the first tab.
Question 3. How to prevent the reports from retrieving when switching to a different tab on a dshboard? Specifying dummy default values in the prompt does
not seem to preven reports from retrieving, which still takes time.
Thank you very much!
RogerRegarding Question 2:
What you need to have is a Dashboard scope dashboard prompt for Product_ID (i.e., Don't use the column prompt from the prompt tab within the Request.)
1) Create the dashboard prompt, put it on tab1 and save the prompt to a presentation variable, say prmtProdID. Set the scope to "dashboard." (This is the default, by the way.) If you create a dashboard prompt and set the scope to "dashboard," then the prompt values selected will hold true across dashboard pages.
2) On tab2, go to your report and in Criteria mode, apply a filter to the Product_ID column making it equal to the PV. (Click the filter icon, Add>Variable>Presentation Variable and type prmtProdID. Save.)
When the user selects a Product_ID on tab1 of your dashboard and hits "Go," not only will it filter your report on tab1, when you go to tab2 the report here will be filtered with the same value selected in the prompt on tab2.
Regarding Question 3:
If you implement 2, you cannot implement 3. You can't have it both ways. Not for the same scenario. But if you want to know how to do it in general, read this:
http://obieeone.com/2009/08/24/how-to-stop-queries-to-automatically-fire-off-once-entering-dashboarddashboard-page/ -
How to copy data from one column to other column
hi,
can any one tell me how to copy data of one column to other column for some specific data
example
productno ocalyear actualsales prevplansales currentplansales
p001 2007 100 120
p002 2007 90 100
p003 2007 120 130
p004 2007 140 120
p005 2007 150 150
i want to copy data of p001 and p002 from prevplansales to current plansales
productno ocalyear actualsales prevplansales currentplansales
p001 2007 100 120 120
p002 2007 90 100 100
p003 2007 120 130
p004 2007 140 120
p005 2007 150 150
is it possible to do?
please suggest me.
i will assign pointsHi,
I think the needed techniques are already described in the documentation, e.g. in
http://help.sap.com/saphelp_nw70/helpdata/en/45/e641e4c61256dee10000000a114a6b/frameset.htm
or
http://help.sap.com/saphelp_nw70/helpdata/en/45/e641e4c61256dee10000000a114a6b/frameset.htm
The main techiques used in the above example to bind the filter of the planning function to selected (marked) objects in the analysis item or to drop down boxes (or both). These techniques are used in the above examples.
Regards,
Gregor -
How to display more than one column with for each
Hi guys,
how to display more than one column with for each like below?
for each
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Item10
End for each
for each
Item1 Item2 Item3
Item4 Item5 Item6
Item7 Item8 Item9
Item10
End for eachTake a look at this to see if the solution provided would work for you: https://blogs.oracle.com/xmlpublisher/entry/multi_column_row_woes
Won't you have more than 10 records in your data file ? If you are going to have only 10 items then you may be able to use position() function to limit it to 3 each..
Take a look at this: https://blogs.oracle.com/xmlpublisher/entry/turning_rows_into_columns
Thanks,
Bipuser -
How do I switch from one column to the next, skip around? Tab key doesn't seem to do itl. I can't find any "help" in "help". Help. Please. Thank you.
Hi Karen,
It is simple.
Columns fill with text as the text becomes enough to spill over from the previous column. Below is an example. I have used a huge (6" botom margin setting to shorten the page to a reasonable length for a screen shot, and turned on Show layout and Show invisibles so the column boundaries and invisible characters can be seen. Here there's no text in column 3 as there is only enough text to fill column 1 and part of column 2.
As more text is added, it eventually fills column 2 and flows into column 3:
You can force the text into the next column by inserting a column break. Here, a column break has repalced the paragraph break in column 2 (after 'fascilisi."):
Regards,
Barry
Maybe you are looking for
-
Not able to access data in Query
Hi, I have loaded data using DTP from 2 different source systems. One is 3.x emulated datasource and the other is New 7.0 datasource.I have loaded data sucessfully in to DSO.Built a query on same. But when iam executing the query by material as selec
-
Need Palm Bluetooth Drivers For Windows 7 64 Bit
Hi, I am a long time Palm Pilot user and I have been there through all the trials and tribulations. I have just bought a new computer running Windows 7 Home Premium 64-Bit edition and I am trying to find the drivers for Bluetooth sync. I am using a
-
Iconia 8 ONE (B1-810) --- Inadequate Volume Range from Internal Speaker
Apologies for the lengthy post. I've seen this question posted before but never really answered in terms of a fix. So here goes: I own an entry-level Samsung Tab III but I'm totally new to Acer. My issue/question has to do with the narrow volume rang
-
How to improve the performance of insert statement.
Hi All, I have one procedure and it inserts 40 million records into one table. As my current method taking long time to accomplish the task, Is there any mechanism to improve the performance Thanks in Advance.
-
Hey people. I'm as angry as the next person for this stupid lagging. For those who are working and don't have the time to swtich back to SL I have found you can pull logic out of the lag by right clicking the app from the dock and clicking the curren