Search Results

Search found 891 results on 36 pages for 'comma'.

Page 5/36 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Query to bring count from comma seperated Value

    - by Mugil
    I have Two Tables One for Storing Products and Other for Storing Orders List. CREATE TABLE ProductsList(ProductId INT NOT NULL PRIMARY KEY, ProductName VARCHAR(50)) INSERT INTO ProductsList(ProductId, ProductName) VALUES(1,'Product A'), (2,'Product B'), (3,'Product C'), (4,'Product D'), (5,'Product E'), (6,'Product F'), (7,'Product G'), (8,'Product H'), (9,'Product I'), (10,'Product J'); CREATE TABLE OrderList(OrderId INT NOT NULL PRIMARY KEY AUTO_INCREMENT, EmailId VARCHAR(50), CSVProductIds VARCHAR(50)) SELECT * FROM OrderList INSERT INTO OrderList(EmailId, CSVProductIds) VALUES('[email protected]', '2,4,1,5,7'), ('[email protected]', '5,7,4'), ('[email protected]', '2'), ('[email protected]', '8,9'), ('[email protected]', '4,5,9'), ('[email protected]', '1,2,3'), ('[email protected]', '9,10'), ('[email protected]', '1,5'); Output ItemName NoOfOrders Product A 4 Product B 3 Product C 1 Product D 3 Product E 4 Product F 0 Product G 2 Product H 1 Product I 2 Product J 1 The Order List Stores the ItemsId as Comma separated value for every customer who places order.Like this i am having more than 40k Records in my dB table Now I am assigned with a task of creating report in which I should display Items and No of People ordered Items as Shown Below I Used Query as below in my PHP to bring the Orders One By One and storing in array. SELECT COUNT(PL.EmailId) FROM OrderList PL WHERE CSVProductIds LIKE '2' OR CSVProductIds LIKE '%,2,%' OR CSVProductIds LIKE '%,2' OR CSVProductIds LIKE '2,%'; 1.Is it possible to get the same out put by using Single Query 2.Does using a like in mysql query slows down the dB when the table has more no of records i.e 40k rows

    Read the article

  • CSS: Horizontal, comma-separated list with fixed <li> width

    - by hello
    Hello, I would like to achieve the following structure: [gfhtfg..., kgjrfg..., asd, mrhgf, ] ^-------^ ^-------^ ^-------^ ^-------^ X X X X (X = a fixed length) I've got a <div> with a fixed length, and inside it an horizontal, comma-separated list (ul) of links. The <li> elements should have a fixed width, and so if the links exceed a fixed length an ellipsis will be shown (using the text-overflow property). I know two ways to make a list horizontal. One is using display: inline and the other using the float property. With the first approach, I can't set a fixed width because the CSS specification doesn't allow setting the width of inline elements. The second approach creates a mess :O Setting float on the <a> element, intending to limit the width there, separates it from the commas. There are no browser-compatibility issues, I only have to support WebKit. I included the code I attempted to work with: <!DOCTYPE html> <html lang="en"> <head> <title>a title</title> <style> body { font-family: arial; font-size: 10pt; } div { height: 30px; width: 300px; background: #eee; border: 1px solid #ccc; text-align: center; } ul { margin: 0px; padding: 0px; } ul li:after { content: ","; } ul li:last-child:after { content: ""; } ul li a { text-decoration: none; color: #666; } ul li { margin: 0px; padding: 0px; list-style: none; overflow: hidden; text-overflow: ellipsis; -webkit-text-overflow: ellipsis; /* Inline elements can't have a width (and they shouldn't according to the specification */ display: inline; width: 30px; } </style> </head> <body> <div> <ul> <li><a href="#">a certain link</a></li> <li><a href="#">link</a></li> <li><a href="#">once again</a></li> <li><a href="#">another one</a></li> </ul> </div> </body> </html> Thank you.

    Read the article

  • Performance difference in for loop condition?

    - by CSharperWithJava
    Hello all, I have a simple question that I am posing mostly for my curiousity. What are the differences between these two lines of code? (in C++) for(int i = 0; i < N, N > 0; i++) for(int i = 0; i < N && N > 0; i++) The selection of the conditions is completely arbitrary, I'm just interested in the differences between , and &&. I'm not a beginner to coding by any means, but I've never bothered with the comma operator. Are there performance/behavior differences or is it purely aesthetic? One last note, I know there are bigger performance fish to fry than a conditional operator, but I'm just curious. Indulge me. Edit Thanks for your answers. It turns out the code that prompted this question had misused the comma operator in the way I've described. I wondered what the difference was and why it wasn't a && operator, but it was just written incorrectly. I didn't think anything was wrong with it because it worked just fine. Thanks for straightening me out.

    Read the article

  • Comma seprated search in mysql query

    - by Ravi Kotwani
    I have search mechanism in my site. For that I have written a large conditional query. $sql = "select * from users where keyword like '%".$_POST['search']."%' OR name like '%".$_POST['search']."%'"; Now, I suppose I have following data on the site: ID Name Keyword 1 Sanjay sanjay, surani 2 Ankit ankit, shah 3 Ravi ravi, kotwani Now, I need the result such that when user writes "sanjay, shah" ($_POST['search'] = 'sanjay, shah') then records 1 and 2 should be displayed. Can I achive this in single mysql query?

    Read the article

  • Populating form fields with comma seperated strings in unordered list onclick with jQuery/Javascript

    - by RyanP13
    Hi, I have an address lookup system which returns addresses in an unordered list like so: <p>Please select your address from the list below</p> <div id="selectAddress"> <ul> <li>HNO 412,addressLine2,addressLine8</li> <li>HNO 413,addressLine2,addressLine8</li> <li>HNO 414,addressLine2,addressLine8</li> </ul> </div> When someone clicks on an li containing the address i use the folloqing jQuery to split it and populate the following form fields. var $customerAddress = $("form#detailsForm input[name*='customerAddress']"); $("div#selectAddress ul li").click(function(){ $(this).removeClass("addressHover"); $("li.addressClick").removeClass("addressClick"); $(this).addClass("addressClick"); var $splitAddress = $(this).text().split(","); $($customerAddress).closest("tr").removeClass("hide"); $($customerAddress).each(function(){ var $inputCount = $(this).index($customerAddress); $(this).val($splitAddress[$inputCount]); }); $.cookies.set('cpqbAddressInputs', 'visible'); }); Form fields: <tr> <th> <label for="customerAddressLine1">Address&nbsp;*</label> </th> <td colspan="3"> <input type="text" name="customerAddressLine1" maxlength="40" value="" id="customerAddressLine1" class="text" /> </td> However it only seems to populate the first line of the address and not lines two and three. I could easily do this manually but i wanted to abstract it so that it could be expanded to cater for any amounts of address lines.

    Read the article

  • Python try...except comma vs 'as' in except

    - by peter
    What is the difference between ',' and 'as' in except statements, eg: try: pass except Exception, exception: pass and: try: pass except Exception as exception: pass Is the second syntax legal in 2.6? It works in CPython 2.6 on Windows but the 2.5 interpreter in cygwin complains that it is invalid. If they are both valid in 2.6 which should I use?

    Read the article

  • how to ingore comma when returning json mvc

    - by Darcy
    Hi all, I'm returning JSON from my controller to my view in order to populate a jquery autocomplete textbox in MVC. The problem is, some of my data contains commas, and therefore is split by the autocomplete helper. Heres my code. Controller: public ActionResult GetData() { var data = repository.GetData(); return Json(data); } View (script): $.post("../MyController/GetData", function(data) { var evalData = eval(data) + ""; //formats the text $("#Data").autocomplete(evalData.split(","), { max: 500, matchContains: true }); }); As you can see, I am using the jquery .split helper to split the returned Json. Should I be using regex or should I go with a completely different approach?

    Read the article

  • How can I create an fscanf format string to accept white space and comma (,) tokenization

    - by Jamie
    I've got some analysis code (myprog) that sucks in data using the following: if(5 == fscanf(in, "%s%lf%f%f%f", tag, & sec, & tgt, & s1, & s2)) which works just fine. But in the situation where I've got data files that are separated by commas, I'm currently doing something like: sed 's/,/ /g' data | myprog Can I modify the format string in the fscanf() function to accept both delimitation formats?

    Read the article

  • how to return comma seperated values in oracle SP

    - by john
    If I have a simple query like: OPEN cursor FOR SELECT USER_ID FROM USER_TABLE WHERE USER_ID = V_SOME_USER; this will return records in different rows but how can I return the rows in the following format: 'userid1', 'userid2', 'userid3'.....'useridN' I want to do this because I want to send this off as a parameter to another stored procedure...Also, what is the limit on how big the string can be when passed to the SP as parameter

    Read the article

  • RegEx/Javascript validation: Don't allow comma as a valid character

    - by baldwingrand
    I'm doing Javascript validation on my number fields. I'm using RegEx to do this - first time RegEx user. I need the user to only enter numbers and decimals, but not commas. (i.e. 3600.00 is okay, but 3,600.00 is not). I can't figure out how to eliminate the commas as an accepted character. Any help is appreciated. Thanks! var filter = /^([0-9])/; if (!filter.test(txtItemAmount.value)) { msg += "Item amount must be a number.\n"; txtItemAmount.focus }

    Read the article

  • Grouping string by comma between brackets

    - by Myra
    Response to : http://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclud Hi,I'm looking for a regex pattern that applies to my string including brackets: [1,2,3,4,5] [abc,ef,g] [0,2,4b,y7] could be anything including word,digit,non-word together or separated. I wish to get the group between brackets by \[(.*?)\] but what is the regex pattern that will give me the group between brackets and sub-group strings separated by commas so that the result may be following ?? Group1 : [1,2,3,4,5] Group1: 1 Group2: 2 Group3: 3 Group4: 4 Group5: 5 Group2 : [abc,ef,g] Group1: abc Group2: ef Group3: g etc .. Thank you for your help

    Read the article

  • Escaping comma in java

    - by prasanna
    I have a string which is fed into the query as IN clause,which looks like this ('ACT','INACT') which is one of the parameters to a function inside a package.when a call is made to the function from java, it looks like this call package.function(1,2,3,('ACT','INACT'),4,5). When the package is called,i get error as wrong type of arguments. It is taking the values inside brackets as different values delimited by strings

    Read the article

  • Create comma separated string from 2 lists the groovy way

    - by Micor
    What I have so far is: def imageColumns = ["products_image", "procuts_subimage1", "products_subimage2", "prodcuts_subimage3", "products_subimage4"] def imageValues = ["1.jpg","2.jpg","3.jpg"] def imageColumnsValues = [] // only care for columns with values imageValues.eachWithIndex { image,i -> imageColumnsValues << "${imageColumns[i]} = '${image}'" } println imageColumnValuePair.join(", ") It works but I think it could be better. Wish there was a collectWithIndex ... Any suggestions?

    Read the article

  • How to put comma in counted numbers?

    - by Ronnie Chester Lynwood
    hey huys im counting my table with this code: $county = mysql_query("SELECT COUNT(id) from table where type = 'application'"); $county = mysql_result($county, 0); $applications = ''.$county.''; this give me result like 1156563. but I want to see it like 1,156,563 with commas. how can i do this?

    Read the article

  • convert std object class to comma seperated string

    - by Kwaasi Djin
    I have an std class object from twitter and i would like to take the ids array values and put them in a php variable $ids where $ids = (15761916,30144785,382747195,19399719). I imagine using a for loop and using phps implode but i'm not sure how to go about it. stdClass Object ( [ids] => Array ( [0] => 15761916 [1] => 30144785 [2] => 382747195 [3] => 19399719 ) [next_cursor] => 0 [next_cursor_str] => 0 [previous_cursor] => 0 [previous_cursor_str] => 0 )

    Read the article

  • SQL use comma-separated values with IN clause

    - by user342944
    I am developing an ASP.NET application and passing a string value like "1,2,3,4" into a procedure to select those values which are IN (1,2,3,4) but its saying "Conversion failed when converting the varchar value '1,2,3,4' to data type int." Here is the aspx code: private void fillRoles() { /*Read in User Profile Data from database */ Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("sp_getUserRoles"); db.AddInParameter(cmd, "@pGroupIDs", System.Data.DbType.String); db.SetParameterValue(cmd, "@pGroupIDs", "1,2,3,4"); IDataReader reader = db.ExecuteReader(cmd); DropDownListRole.DataTextField = "Group"; DropDownListRole.DataValueField = "ID"; while (reader.Read()) { DropDownListRole.Items.Add((new ListItem(reader[1].ToString(), reader[0].ToString()))); } reader.Close(); } Here is my procedure: CREATE Procedure [dbo].[sp_getUserRoles](@pGroupIDs varchar(50)) AS BEGIN SELECT * FROM CheckList_Groups Where id in (@pGroupIDs) END

    Read the article

  • IE showing "decimal" instead of "comma"

    - by John Stewart
    I am having an issue with a slider (implemented using Prototype) and IE7. Upon the slider value change I update a with the value such as "420,000". Now on all browsers other than IE7 this is display correctly. But on IE7 it is displayed as "420.000" .. my question is how did the "," become "." the page has UTF-8 meta tag. Any help?

    Read the article

  • Retrieve rows where a value exists within a comma separated list

    - by Klaaz
    I like to reverse this query: SELECT * FROM table WHERE status IN ( option,option1,option2 ); in a query like SELECT * FROM table WHERE status contains ( 'option' ); Where field 'status' column contains (by example): 'option,option1'. When I use SELECT * FROM table WHERE status LIKE '%option%' ); It also selects the rows with a 'status' column that only contains 'option1' Is this possible? example data: id,name,status 1,'test1','option,option1' 2,'test2','option,option2' 3,'test3','option2' 4,'test4','option2,option3' 5,'test5','option' SELECT * FROM table WHERE status contains ( 'option' ); This query should select select record 1,2 and 5. 'status' field type is varchar. The problem is that the status fields contains data that is almost alike, exept from the added number to option. Off course this is a made up example but the real thing has this kind of parameters

    Read the article

  • comma in regex in String.replaceAll() method?

    - by kknight
    My code tries to replace "," with "/" in a string. Should I escape "," in the regex string? Both of the two code snippets generated the same results, so I am confused. Code snippet 1: String test = "a,bc,def"; System.out.println(test.replaceAll("\\,", "/")); Code snippet 2: String test = "a,bc,def"; System.out.println(test.replaceAll(",", "/")); Should I use "," or "\,"? Which is safer? Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >