Print data with Format separated by commas.
HelloI need to establish a rapport with the values in column format, separated by commas. I use > > express edition of oracle 11g
Table used names and customer number, he participated in the interview, it is stored in the format below.
my requirement for the report is shown belowemp_name client_name
JAMES HAS
JAMES B
JAMES C
ALEX HAS
ALEX D
SCOTT B
SCOTT C
please advise me is there any function that converts and print format separated by commas.emp_name count (client_name) client_name
JAMES 3 A, B, C
ALEX 2A, D
2 B, C SCOTT
Thank you
Sudhir
Try this...
/ * code deleted after suggested by BluShadow * /.
I'll post other methods of String-aggregation...
Try this...
select
emp_name,
count(client_name) cnt,
rtrim(XMLAGG(xmlelement(e, client_name||',')).extract('//text()'),',')
from xx
group by emp_name
order by cnt desc;
For versions > 11g Release 2
select
emp_name,
count(*) cnt,
LISTAGG(client_name,',') WITHIN GROUP(ORDER BY NULL)
from xx
group by emp_name;
Published by: Vanessa B on 7 December 2012 18:50
-adding code
Tags: Database
Similar Questions
-
problem with column separated by commas
I'm running into a problem with the following table structure
CREATE TABLE «DETAILS»
(
'ID' NUMBER (22.0) NOT NULL,
VARCHAR2 (150 CHAR) 'NAME' NOT NULL,
"COVER" VARCHAR2 (150 CHAR) NOT NULL
);
Insert into EXPORT_TABLE (ID, NAME, COVER) values (252613546, 'VCONBU', ', 252612938,');
Insert into EXPORT_TABLE (ID, NAME, COVER) values (252613549, 'SPMABU', ', 252612932,');
INSERT INTO EXPORT_TABLE (ID, NAME, COVER) VALUES (252612938, 'HOSTEDTG', NULL);
Insert into EXPORT_TABLE (ID, NAME, COVER) values (252612932, 'INSTG', null);
Insert into EXPORT_TABLE (ID, NAME, COVER) values (367708813, 'ICF_1', ', 252613546,');
Insert into EXPORT_TABLE (ID, NAME, COVER) values (364413059, 'CSWSPT', ', 252613549,');
commit;
Output
ID NAME COVER 252613546 VCONBU HOSTEDTG 252613549 SPMABU INSTG 252612938 HOSTEDTG 252612932 INSTG 367708813 ICF_1 VCONBU 364413059 CSWSPT SPMABU Hello
You may want a self-join, like this:
SELECT c.id
c.name
p.name AS cover
Of export_table c
LEFT JOIN export_table p WE «,» | p.ID
|| ',' = c.lid
;
-
AS %s with entry separated by commas
I'm trying to get a recordeset WHERE the nameArtist of the column 'contains' the 'artist' URL parameter For example, if 'Picasso' is in the parameter and then he must find all projects whose Picasso worked on. The problem is that often the nameArtist column contains an artist for example "Mondrian, Picasso, Chagall. He should always filter this project.
I tried with LIKE, but that does not give the projects when there are more artists.
I hope someone can give me a tip I did wrong here... Thankx.
$colname_rsAllprojects = "-1"; if (isset($_GET['artist'])) { $colname_rsAllprojects = $_GET['artist']; } mysql_select_db($database_connCasco, $connCasco); $query_rsAllprojects = sprintf("SELECT * FROM `2008_content` WHERE nameArtist LIKE %s ORDER BY projectyear DESC", GetSQLValueString($colname_rsAllprojects, "text")); $rsAllprojects = mysql_query($query_rsAllprojects, $connCasco) or die(mysql_error()); $row_rsAllprojects = mysql_fetch_assoc($rsAllprojects); $totalRows_rsAllprojects = mysql_num_rows($rsAllprojects);
Brégent is correct. You must put % before and after the value you're looking for. However, put just like it in the SQL query won't work, because Dreamweaver use sprintf() to pass the value to a custom named GetSQLValueString() function to prevent the injection of SQL code. The % must be added to the value passed to GetSQLValueString().
Dreamweaver doesn't automatically when you add them % to the variable in the SQL of the advanced Recordset dialog box. However, I seem to remember that the way you did in the dialog box has changed in CS3 or CS4. No matter which version you use, it should work in all versions if you edit the PHP code like this:
$query_rsAllprojects = sprintf("SELECT * FROM `2008_content`WHERE nameArtist LIKE %s ORDER BY projectyear DESC", GetSQLValueString("%" . $colname_rsAllprojects . "%", "text"));
-
Extract values separated by commas in xquery string
Hello
We get a string with values separated by comma Ex: a, b, c.
Our requirement is to mark the string and transform values to an XML using xquery.
I'm new to xquery. Can someone help me on this please.
Thank you
ChauvinHi Jacky,.
You can use the function "mark".
For example:let $str := "a,b,c" return
{ for $i in tokenize($str,",") return - { $i }
}will return:
- a
- b
- c
-
Splitting data separated by commas
Hi friends,
I have a few million records that must be formatted as data and need your help with this.
Actual data in the csv file:
«30375516451 ',' June 3, 2013 23:31:33 ","June 4, 13"," Tag #: 2490544Sharjah - White 33708 ", 'Al Garhoud bridge nine', 'Abu Dhabi', '4.00»»'
Value using request, separated by commas:
Select
Replace (replace (replace (replace (test_value,'"', null"), chr (13), null), chr (160), null), chr (10), null) "test_value"
of the test
where to_number (length (test_value) - length (replace(test_value,',',''))) in (3.6);
Output:
30375516451, 03-Jun-2013 23:31:33, 4 June 13, Tag #: 2490565Sharjah - white 33708, new Al Garhoud bridge Abu Dhabi, 4.00
Need to change a part with highest result of the query to make it entirely comma separated:
Tag #: 2490565Sharjah - White 33708,.
Output:
2490565, Sharjah, 33708 white,-remove the space before the comma: white 33708,.
Power required:
30375516451, 03-Jun-2013 23:31:33, June 4, 13, 2490544, Sharjah, white 33708, Al Garhoud new bridge, Abu Dhabi, 4.00
Sample data:
CREATE TABLE TEST (TEST_VALUE VARCHAR2 (4000));
INSERT INTO TEST VALUES (' "30375516451","June 3, 2013 23:31:33", "June 4, 13","Tag #: 2490565Sharjah - White 33708", "Al Garhoud bridge nine", "Abu Dhabi", "4.00" ' ");
Thank you
with the trial as)
Select "" 30375516451 ',' June 3, 2013 23:31:33 ","June 4, 13"," Tag #: 2490544Sharjah - 33708 white ', 'Al Garhoud New Bridge', 'Abu Dhabi', '4.00' ' test_value»
of the double
)
Select regexp_replace)
regexp_replace)
test_value,
'( *")| [' || Chr (13) | Chr (160) | Chr (10) | ']',
NULL,
1,
0,
« n »
),
'Tag #:(\d+)(.+) - ([^,]+)',
'\1,\2,\3 '.
) test_value
of the test
/TEST_VALUE
--------------------------------------------------------------------------------------------------------------
30375516451, 03-Jun-2013 23:31:33, 04-Jun-13, 2490544, Sharjah, White 33708, new Al Garhoud bridge Abu Dhabi, 4.00SQL >
SY.
-
Display data in the form of values separated by commas - need help
Hi all
I have some data formatted in the way below. The ID of the drug are the primary keys of the table and the first 9 digits in the drug ID are the same. They can be separated based on the last two digits.
Type of drug drug ID
00603107554 respiratory
00603107556 cough and cold
Antitussive-00603107558
I want that data to be formatted as
Type of drug drug ID
006031075 respiratory, cough and colds, Antitussive
I want to cut the last two characters, and format data. And the types must be displayed in the form of values separated by commas. Can someone help me?
Thanks in advance
RambeauWITH t AS (SELECT '00603107554' Drug_ID, 'Respiratory' Drug_Type FROM DUAL UNION SELECT '00603107556', 'Cough and Cold' FROM DUAL UNION SELECT '00603107558', 'Antitussive' FROM DUAL) SELECT Drug_id, SUBSTR (SYS_CONNECT_BY_PATH (Drug_Type, ','), 2) Drug_Types FROM (SELECT SUBSTR (drug_id, 1, LENGTH (drug_id) - 2) drug_id, Drug_Type, ROW_NUMBER () OVER (PARTITION BY SUBSTR (drug_id, 1, LENGTH (drug_id) - 2) ORDER BY Drug_Type) rn FROM t) WHERE CONNECT_BY_ISLEAF = 1 START WITH rn = 1 CONNECT BY PRIOR rn = rn - 1 AND PRIOR drug_id = drug_id
DRUG_ID DRUG_TYPES 006031075 Antitussive,Cough and Cold,Respiratory
just a note, I wonder if blushadow could consider adding techniques agg string to its very useful faq section because it seems a good
request.Published by: pollywog on April 14, 2011 06:42
Published by: pollywog on April 14, 2011 06:43
-
How to print an entry separated by commas
I would like to print an entry separated by commas to separate entries:
Like when I put like <? PHP echo $row_rsContent ['artists'];? > I get: 'Picasso, Chagall, Matisse,' but I want like "Picasso < br > < br > Matisse to Chagall.
And I also want to 'Picasso' a link to another Web site.
Thanks for any help of furthre.
Pass your variable to explode() to make a table. Then do what you want with each item.
$artists = explode(',', $row_rsContent['artists']); echo '' . $artists[0] .
'; echo $artists[1]. '
' . $artists[2] . '
'; -
When I view my Photos, they have a place and a date. How can I print them with that on them?
You want to print the information on the image itself? To do this, you will need to export the picture on the desk and edit it with a 3rd party image editor that supports the text and layers:
Some Image editors that support layers and text:
Photoshop Elements for Mac 11 - $79
GraphicConverter - $40
The Rainbow painter - $30Photos of affinity- $50
FX Photo Studio - $30
Inpaint - $20
Imaging - $38
Acorn - $50Pixelmator - $60
Seashore - free
GIMP for Mac - free (Yosemite & Mavericks only)
-
LaserJet 4000 printing error with USB/parallel interface and DATA light on at all TIMES
Laptop Dell Vostro 3700, Windows 7/32, Laserjet 4000, connected via the USB interface cable / parallel on USB001. Interface drivers and printer installed automatically after starting the update of Windows PC.
Single document print OK.
Document of several pages: printer data LED flashes then REMAINS ON permanently. Printed front page sometimes, sometimes not.
After some time, box status Control Panel/print poster printer fault and a yellow exclamation point appears on the printer icon.
No possible mistake OK with MS print Fixit. No other printing possible before initialization of the PC and then to new as shown above.
Same printer connected via a parallel cable that is normal for old PC Windows 2000 print OK.
Help, please!
SOLUTION FOUND!
A SOLUTION THAT WORKS: add only DC powered USB hub and connect the printer to one of the ports of the hub-s. Let Windows install the drivers for the USB cable and printer and printing is perfect!
It is that the laptop USB ports do not have enough current or voltage, especially if some other USB devices are connected to the laptop...
-
Problem with display Inlines for comma separated output (horizontally)
Hi all
It's my XML data,
-< EMP_IDS >
-< > 10001 EMP_ID < / EMP_ID >
-< > 10002 EMP_ID < / EMP_ID >
-< > 10003 EMP_ID < / EMP_ID >
-< > 10004 EMP_ID < / EMP_ID >
-< > 10005 EMP_ID < / EMP_ID >
-< / EMP_IDS >
I show all emp_ids in a single horizontal line, separated by commas, using this code
10001,10002,10003,10004,10005.
<? xdoxslt:set_variable($_XDOCTX,'C',count(.//EMP_ID))? > <? for-each@inlines:EMP_ID? > <? ? >
<? If@inlines:position ()! = xdoxslt:get_variable($_XDOCTX,'C')? >, <? end if? >
<? If@inlines:position () = xdoxslt:get_variable($_XDOCTX,'C')? >. <? end if? >
<? end foreach? >
Question: What I want is that when my EMP_ID = ' 10002 "should NOT be displayed, so I want the output to be
10001,10003,10004,10005.
I am unable to code this, is there any way by which I can take the value 10002 in a variable and use an if statement to not show this value?
Help, please.
Thank you
Ronnycan u try this
-
Problem using the list separated by commas with nested table element
Hello
I have a list separated by commas like this:
And want to create a function that creates a where clause clause for each element with an output like this:H23004,H24005,T7231,T8231,T9231
Here's my test function that is not working properly:UPPER('H23004') IN (UPPER(charge)) OR UPPER('H23005') IN (UPPER(charge)) OR UPPER('T7231') IN (UPPER(charge)) OR UPPER('T8231') IN (UPPER(charge)) OR UPPER('T9231') IN (UPPER(charge))
The out put looks like this:create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is -- declaration of list type TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE; -- variable for Batches v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || ''''); return_script varchar2(1000); BEGIN -- loop as long as there are objects left FOR i IN v_batch.FIRST .. v_batch.LAST LOOP --DBMS_OUTPUT.PUT_LINE(offices(i)); -- create where clause IF i = 1 THEN return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))'; ELSE return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))'; END IF; END LOOP; return (return_script); end;
I don't know what I did wrong? It calculates the amount of the incorrect array element! (v_batch. Must be 5)UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))
v_batch. FIRST = 1
v_batch. LAST = 1
Kind regards
TobiasTry this...
declare
text varchar2 (1000): = "H23004, H24005, T7231, T8231, T9231;
v_where varchar2 (1000);
Start
Text: = text | «, » ;
While instr (text, ',') <> 0
loop
v_where: = v_where | ' UPPER ("': substr (Text, 1, InStr(Text,',',1)-1) |") ' IN (UPPER (load)) OR ';
text: = substr (text, instr(text,',',1) + 1);
end loop;
v_where: = substr (v_where, 1, length (v_where)-3);
dbms_output.put_line (v_where);
end;convert it to function...
-
Separation of data with multiple headers
Hello
I have a data set that has 6 columns with headers containing information for a cycle of some (data file is attached). About 200 lines later, so that I have a different set of data with 6 columns cycle 2 with a space and a new header and any other 400 lines later I data for cycle 5 with a space and a new header. This pattern is repeated throughout the data set.
I need a way to separate this data so that I can trace different cycles. When I import this data set in Diadem with the Wizzard use it does not recognize the spaces and the new headers. He label spaces and headers "NO value", there are discontinuities in the data. Is there a way to separate the cycles in this dataset in tiara?
For example, I would have 215 lines thru 220 630 thru 6 lines, lines 635 thru 1046, lines 1051 to 1462, etc.. This way I can trace different cycles against the execution time.
Hi wils01,
Here's a use I created that loads your file data in each cycle in a separate group of the data portal.
Brad Turpin
Tiara Product Support Engineer
National Instruments
-
Order by date with a format mask column
10g - 10.2.0
Hello
This is my request
When I run this I get: not a GROUP BY expressionselect to_char(exp_Date,'Mon-YYYY') dt, count(*) from exp_main where exp_type like 'Income%Photo%' group by to_char(exp_Date,'Mon-YYYY') order by exp_date
If I remove the order by, it works fine.
Is it possible to order by since the output of the query is sorted character.
I search online most suggested to use the order of column_name. But does not work for me.
Thank you!
RyanHello
Keep the date information as a DATE, with the exception (if required) for display. That means that GROUP BY and ORDER BY DATE, not a string:
SELECT TO_CHAR ( TRUNC (exp_Date, 'MONTH') , 'Mon-YYYY' ) AS dt , COUNT (*) AS cnt FROM exp_main WHERE exp_type LIKE 'Income%Photo%' GROUP BY TRUNC (exp_Date, 'MONTH') ORDER BY TRUNC (exp_date, 'MONTH') ;
-
With the help of a string of separated by commas as lines
HT a column in which I store the name separated by commas, I have to show them that the lines in a report...
Help, pleaseCheck out this link...
http://nimishgarg.blogspot.com/2009/12/Oracle-SQL-use-comma-seprated-string-to.html
-
Build the string separated by commas in query with Expression box sub
Oracle 10g on Windows XP
Consider the following query:
Select batch_id, tr state_tag_seq where request_type in (select case WHEN PX = 'RETURN' AND 'TRANSFER' |) «, » || "PUBLIC TRANSIT"
WHEN PX = "RFT" THEN "TRANSIT".
ELSE 'Invalid '.
END
OF THE DOUBLE
) ;
In this case, PX is accepted to execution of the user interface.
I'm having no rows returned (all valid lines matching in DB) for the following case assessment
WHEN PX = 'RETURN' THEN 'TRANSFER '. «, » ||' Transit "(PX when is evaluated to 'RETURN')
The application works well when it px IS estimated to be "PCR" (as the evaluated expression is just a string ('TRANSIT') single, not separated by commas, as in the other case)
Hiow do rewrite this query, if it gives a correct result? In other words, I actually build the query string slot, which is assessed by the external when query clause.
I think it might be a specific way to use quotes in my case expression, but I'm reaching an impasse. Any help is appreciated.
Thank you
SRYou can try
select batch_id, state_tag_seq from tr where request_type member of case when px = 'RETURN' then sys.dbms_debug_vc2coll ( 'TRANSFER', 'TRANSIT' ) when px = 'RFT' then sys.dbms_debug_vc2coll ('TRANSIT') else sys.dbms_debug_vc2coll ('Invalid') end
Maybe you are looking for
-
After passing to MSE confiscated the SpamFilter in the bundle of security, it replaced.
I need a stand-alone ANTI-SPAM filter that works well with MS Office Outlook that is used on our desktops and Outlook Express that is used on our laptops. Free filters are naturally friendly but often required luggage usually included with the 'free'
-
unexpected end of file error for Photoshop CC 2015
Hey guys so I got this unexpected end of file error for Photoshop CC 2015. Now, I've discovered the file that had problems was libcef.dll, by using the event viewer and by reading the details. Now the crazy part is that I NEED this software for my st
-
error in pseudo-column "DECODE" can be used within an SQL statement
Hi gurus,Your help is grealty appreciated. Please help me.I'm trying to see if I can use the function decode as below and get the error, here below vPlatformfrom value would be QA or MTSvDataBase1 :='@'|| Decode (vPlatformfrom, 'STD', 'STD', 'QA', 'Q
-
I can't cancel the membership online
order AD003157181UKIt is impossible to cancel online
-
Wieso kann ich Adobe Creative cloud nicht deinstallieren?
Habe PD CS6 neu installliert und da ist noch sharp Cloud hinzugekommen. Depending on ich beim Fenster "Erste steps mit creative cloud" nichts unternommen habe und den PC herunterfahren wanted, habe ich communications, dass noch dieses Programm im so