read the entry separated by commas?
I work with PHPMySQL in the database, I have a separate entrance which is casco_cat_id = 1,5,6.
Now I want to get all the entries that have a '5' (for example) casco_cat_id. I tried that line but it has no result:
SELECT * FROM '2008_content' WHERE casco_cat_id LIKE ' 5'
Is LOVE not right?
Thanks for any help, tutorials, where to look?
SELECT * FROM `2008_content` WHERE FIND_IN_SET('5' casco_cat_id)
Tags: Dreamweaver
Similar Questions
-
How to store the values separated by commas
Hi all
I have a table named discount, with discount_id (number data type) as one of the columns.
The user gives an entry as the value separated by commas, (ex: '123,27890,3543')
I use built-in proc that separates the values separated by commas.
Result set is stored in a table.DECLARE l_input VARCHAR2 (4000) := '123,27890,3543'; l_count BINARY_INTEGER; l_array DBMS_UTILITY.lname_array; BEGIN DBMS_UTILITY.comma_to_table ( list => REGEXP_REPLACE (l_input, '(^|,)', '\1x'), tablen => l_count, tab => l_array); DBMS_OUTPUT.put_line (l_count); FOR i IN 1 .. l_count LOOP DBMS_OUTPUT.put_line ( 'Element ' || TO_CHAR (i) || ' of array contains: ' || SUBSTR (l_array (i), 2)); END LOOP; END; Result: 3 Element 1 of array contains: 123 Element 2 of array contains: 27890 Element 3 of array contains: 3543
I would like to do a select on the table of discounts
Select * discount where discount_id (123, 27890 3543).
I am looking for options,
I need to create a new physical table as
Create table new_table (identification number) and bulk insert in this table.
Select * discount where discount_id in (select distinct id of new_table).
or
Is there a better way?
THX
Rod.Hello, SamFisher.
May be the recursive subquery factoring help you?WITH test(f1, n) AS (select '12, 15, 235', 1 from dual UNION all select f1, n + 1 from test where n < regexp_count('12, 15, 235', ',') + 1) SELECT regexp_substr(f1, '[^, ]+', 1, n) f FROM test
-
Convert the string separated by commas in the rows
Dear gurus,
I want to convert the string separated by commas in the rows to insert in the collection.
for example, the string 1234,2323,23232,2343,34234
Higher up in the chain must be converted to ranks in order to insert into the table or the collection
Thanks in advance
SanjeevString in rows separated to convert the comma.
with t as ( select '1234,2323,23232,2343,34234' as txt from dual ) select REGEXP_SUBSTR (txt, '[^,]+', 1, level) from t connect by level <= length(regexp_replace(txt,'[^,]*'))+1
-
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] . '
'; -
How to get the values separated by commas of multiple records in table
How to get the values separated by commas of multiple records in table
for example
name address age sex
a 12 m e
b hh 12 f
BB c 13 h
I need to get output as a, b, c from a queryUse the query as below he works for me, change the names of tables and columns
SELECT SUBSTR (SYS_CONNECT_BY_PATH (PROXY_EMAIL, ','), 2) csv FROM (SELECT PROXY_EMAIL, ROW_NUMBER () ON the rn (ORDER OF PROXY_EMAIL), COUNT (*) NTC (STARS_PROXY_ASSIGNMENT) WHERE EMPLID = #EMPLID) WHERE rn = cnt START WITH rn = 1 CONNECT BY rn = rn + 1 ADVANCE
-
Entering both the keywords separated by comma
Does anyone know how to enter keywords for the stock footage at the same time (separated by commas) to the new site of contributor Adobe Stock?
Thank you for your question. The ability to copy and paste keywords is not a feature that is available at this time. Please note that if you embed your keywords in the metadata of your content before downloading, the system automatically reads the keywords and they will be applied to your presentation files.
Kind regards
Mat Hayward
-
How to recover the vales separated by commas in the same column in Oracle SQL
Dear members
Please give me the solution for the below question
Oracle table
Ename product
A 1,2,3
B 1,2,3
Product column has data like this only separated by commas
Output should be like this.
Ename, product
A 1
A 2
A 3
B 1
B 2
B 3
Can we get the output above using just Oracle SQL select statement?
I tried in Google I got an answer in SQL server, there is something called "Cross apply split" function, I'm not sure in Oracle.Welcome to the forum.
Here is another interesting site, with lots of useful examples:
http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:2189860818012 #2654179200346949517Also, be sure to read the SQL and PL/SQL FAQ:
http://forums.Oracle.com/forums/Ann.jspa?annID=1535 -
Read the entry to the XML page format and analyze
Hello
I use JDeveloper 11.1.1.6
I have to get feedback from the page that will be in valid xml format.
This entry is converted to a string and is used inside a bean for validation.
How can I read the XML page entry and analyze?
Thank you.The buttonListener from my first post shows how to access the data on the page (you have to change the attribute name).
You can get it in string asString data = (String)attr.getInputValue();
Now you have the XML as a string.
Does that answer your question?Timo
-
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
-
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...
-
How to pass the values separated by commas in SQL query
Hi all
I use Oracle APEX 4.2
I've created a report of iterative with condition 1 ITEM IS NOT NULL.
This is the SQL query
SELECT MY. ACCT_ID,
JAI DETAILS
The ACCT MA, ACCT_hist EB
WHERE MY. ACCT_IK = EB. ACCT_IK
AND MY. ACCT_ID IN (: P3_IN_MRN);
A P3_IN_MRN element is a text field. The thing is that it works if I give a value, but its does not work if I have several values with comma separated as 123,345,543.
What could be the solution for multiple values in the SELECT query.
Really appreciate your help.
I made use of this on pretty much every project I've worked on:
https://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:210612357425
Hope that helps.
Duncs
-
Display values in the columns separated by commas.
Hello world
Table 1
col1 col2 ID1 Name1 ID2 name2 ID3 Name3 Table 2
col1 col2 RQ1 1 RQ2 3, 2 rQ3 2, 3 Result table
col1 col2 RQ1 Name1 RQ2 Name2, Name3 rQ3 name2, Name3 Based on table 1 and table 2 to create a view to produce a result array.
Ideas experts!
Little things...
First of all, given in TABLE1. Col1 stores values as ID1, ID2... But the associated column in TABLE2. Col2 stores the value in the form 1, 2... Is this correct? Then, the data into TABLE2. Col2 is not the right way to store your data. TABLE2 is not standardized. And it is a very bad way to design a database.
Says you can try this solution here I Unpivot firstly the list of values in TABLE2. Col2 in lines and then enclose it with TABLE1 and finally make an aggregation of chain. It is a solution prior 11g. If you are on 11g and above, you can use functions like UNPIVOT and LISTAGG wisely.
with table1
as
(
Select "id1" col1, col2 "Name1" Union double all the
Select "id2" col1, col2 "Name2" Union double all the
Select 'id3' col1, col2 "Name3" of the double
),
Table2
as
(
Select "rq1" col1, col2 '1' of any Union double
Select "rq2" col1, col2 '3.2' of any union double
Select "rq3" col1, col2 '2.3 ' double '.
)
table2_expand
as
(
Select col1
, regexp_substr (col2, ' [^,] +', 1, level) col2
level lvl
from table2 t2
connect
by level<= length(col2)="" -="" length(replace(col2,="" ','))="" +="">=>
and col1 = col1 prior
and prior sys_guid() is not null
)
Select col1, ltrim (sys_connect_by_path (col2, ',') ',') col2
BeO
Select t2.col1, t1.col2, row_number() over NWR (partition by order of t2.col1 of t2.lvl)
FROM table1 t1
Join the t2 table2_expand
on t1.col1 = 'id ' | T2.col2
)
where connect_by_isleaf = 1
beginning
with rno = 1
connect
by rno = prior rno + 1
and col1 = col1 prior
-
divide the string separated by commas into columns
Hello
I have the following string
The above string must be divided into 4 different columnsstr := 'abcd,123,defoifcd,87765'
How can I achieve that
Thank youHello
Use REGEXP_SUBSTR:
SELECT REGEXP_SUBSTR (str, '[^,]+', 1, 1) AS part_1 , REGEXP_SUBSTR (str, '[^,]+', 1, 2) AS part_2 , REGEXP_SUBSTR (str, '[^,]+', 1, 3) AS part_3 , REGEXP_SUBSTR (str, '[^,]+', 1, 4) AS part_4 FROM table_x ;
Str can contain foul? For example, you can have a string like ' foo, bar ", where you want to count part_2 and part_3 as NULL and 'bar' is part_4? If so:
SELECT RTRIM (REGEXP_SUBSTR (str, '[^,]*,', 1, 1), ',') AS part_1 , RTRIM (REGEXP_SUBSTR (str, '[^,]*,', 1, 2), ',') AS part_2 , RTRIM (REGEXP_SUBSTR (str, '[^,]*,', 1, 3), ',') AS part_3 , LTRIM (REGEXP_SUBSTR (str, ',[^,]*', 1, 3), ',') AS part_4 FROM table_x ;
Published by: Frank Kulash, February 14, 2012 08:46
-
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"));
-
I'm reading the entries of a parser to communicate with the computer via a USB port. I tried to use the RS232 DASYlab input module, but he always says he's waiting for a signal. I have attached the Protocol for the parser. Can what settings I change to display these values?
Basically, if your device is equipped with a USB adapter and the adapter is not simulating a RS-232 port, you have only two choices:
(1) the manufacturer will provide you with a driver DASYLab in the same way that it could provide one of a LabView
(2) the manufacturer as a programming library with, at least, a C or Python library. In this case, you can write your own driver in Python using the script module in 13 DASYLab
If the unit has a RS232 Simulator, then you need to look in your manual and use the correct symbol.
Maybe you are looking for
-
Seagate GoFlex use Time machine?
I have a Seagate FreeAgent GoFlex drive which I used for a while, but now it stopped working and I get messages for the reformat. I got Snow Leopard when I first installed and now I have mountain lion, except that I can't think of any other changes t
-
I am looking for an A300-1BZ and a high functionality on my wish list is supported Intel VT. Can anyone confirm if this device supports Intel VT Thank you Mick
-
microphone/record scrambled
Hello. Got a HP15 N028. I reccently noticed this problem while Skyping. The other end could barely hear me. It looked like coming throuhg a tunnel. I recorded my voice and played back, thanks to Skype and Windows Media. Indeed, there is a problem. My
-
How to move the King with the castle on the titans of chess?
I'm not sure of what is called the movement but in titans of chess, the computer moves the King with the Castle, how to make the same move? I'm new to this, so any help would be a great help.
-
Hello, (this the mystery of on and Off and back on Windows Firewall with slow loading of programs like Internet Explorer as this all is pass it on firewall, disable the firewall, the firewall, it occurs only during starts, after he fine / but very an