Search Results

Search found 22901 results on 917 pages for 'query bug'.

Page 28/917 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • inserting array into database table in single query

    - by Praveen Prasad
    iam having an array of items like [item1,itmem2,item3]; i have to insert these items at a particular userId: final results look like this UserId ItemId 2 || item1 2 || item2 2 || item3 currently iam looping through the array in php code and inserting each item one by one eg foreach($items as $item) { insert into items (UserId,ItemId) value (2,$item); } is it possible i can insert all entries in single query.

    Read the article

  • SQLite Query to Insert a record If not exists

    - by Tharindu Madushanka
    I want to insert a record into a sqlite table if its actually not inserted. Let's say it has three fields pk, name, address I want to INSERT new record with name if that name not added preveously. Can we do with this in a single Query. Seems like its slightly different from SQL Queries sometimes. Thanks you, Tharindu Madushanka

    Read the article

  • CakePHP - Paginate / Query: find lowest of multiple fields & order by it

    - by Atea
    I am using CakePHP for a price-comparison website. I have a table products with fields: id, pride_regular, price_action. I would like to combine the fields price_regular and price_action into a dynamic field: price. The lowest value of these two fields should be the value of the new price field. Also I want to order on it Ascending. Should I use a custom MySQL-query?

    Read the article

  • What is the fastest findByName query with hibernate?

    - by Karussell
    I am sure I can improve the performance of the following findByName query of hibernate: public List<User> findByName(String name) { session.createCriteria(User.class).add(Restrictions.eq("name", name)).list(); } In which way should I improve it or even more important: in which ways should I improve it first? I will need the full object with all the collections (layz or not) and deps of this class.

    Read the article

  • need an sql query

    - by CKeven
    I currently have two tables: 1. car(plate_number, brand, cid) 2. borrow(StartDate, endDate, brand, id) I want to write a query to get all available brand and count of available cars for each brand

    Read the article

  • SQL concatenate rows query

    - by bobobobo
    Say we have a table table posts +---------+-----------+--------------------------------+ | postId | title | status | bodyText | +---------+-----------+--------------------------------+ | 1 | Hello! | deleted | A deleted post! | | 2 | Hello 2! | deleted | Another one! | Can we, in SQL, retrieve a concatenation of a field across rows, by issuing a single query, not having to do the join up in a loop in our back-end code? Something like select title from posts group by status ; Should give "Hello!, Hello 2!"

    Read the article

  • how to optimize this query?

    - by jest
    hi! the query is: select employee_id, last_name, salary, round((salary+(salary*0.15)), 0) as NewSalary, (round((salary+(salary*0.15)), 0) - salary) as “IncreaseAmount” from employees; can i optimize this round((salary+(salary*0.15)), 0) part in anyway, so that it doesn't appear twice..i tried giving it an alias but didn't work :(

    Read the article

  • writting an sql query

    - by Praveen Prasad
    iam having 2 tables table Items Table (this table holds all items iam having) itemId --------- Item1 Item2 Item3 Item4 Item5 table 2 users_item relation UserId || ItemId 1 || Item1 1 || Item2 userId one has stored 2 items Item1,Item2. Now i want to write a query on table1 (Items table) so that it displays all items which user1 has NOT chosen.

    Read the article

  • SQL query, select from 2 tables random

    - by klaus
    Hello all i have a problem that i just CANT get to work like i what it.. i want to show news and reviews (2 tables) and i want to have random output and not the same output here is my query i really hope some one can explain me what i do wrong SELECT anmeldelser.billed_sti , anmeldelser.overskrift , anmeldelser.indhold , anmeldelser.id , anmeldelser.godkendt FROM anmeldelser LIMIT 0,6 UNION ALL SELECT nyheder.id , nyheder.billed_sti , nyheder.overskrift , nyheder.indhold , nyheder.godkendt FROM nyheder ORDER BY rand() LIMIT 0,6

    Read the article

  • how to reverse the order of words in query or c#

    - by Ranjana
    i have stored in the database as location India,Tamilnadu,Chennai,Annanagar while i bind in the grid view it ll be displaying as 'India,Tamilnadu,Chennai,Annanagar' this format. but i need to be displayed as 'Annanagar,Chennai,Tamilnadu,India' in this format. how to perform this reverse order in query or in c#

    Read the article

  • pgSQL query error

    - by running4surival
    i tried using this query: "SELECT * FROM guests WHERE event_id=".$id." GROUP BY member_id;" and I'm getting this error: ERROR: column "guests.id" must appear in the GROUP BY clause or be used in an aggregate function can anyone explain how i can work around this?

    Read the article

  • Solr OR query for different combination of facets

    - by Ritesh M Nayak
    I have a sample Solr schema as follows isPublic = boolean source = facebook| twitter | wordpress I want to write a query which returns all documents from the index which matches either the isPublic = true or isPublic is false and source= facebook. Something like this solrUrl/?q=blah&fq=(isPublic:true OR (isPublic:false AND source:facebook)) Is such a thing possible or should I search the index two times with each of these conditions and then combine + de-duplicate the results?

    Read the article

  • criticle join query mysql

    - by Bharanikumar
    i have table country and having country name and country code, i have customer table having countomer mobile number like customer_mobile field values like 0044-123456798 , 0024-582654753 , 012-52686145 , i want to populate my country oce into combo, that country name should in customer table which country code count is high that country name should come in the dropdown list top , How to write the join query... Thanks

    Read the article

  • select query related problem

    - by user222585
    i have interest rate and amount in a table where interest rate are ranged in different values like 4.5,4.6,5.2,5.6 etc. i want to get sum of amounts classified by interest rate where interest rate will be separated by .25. for example all amount having interest rate 1.25,1.3,1.4 will be in one group and 1.5,1.67,1.9 will be in another group how can i write the query?

    Read the article

  • Why does this properly escaped SQL query fail?

    - by Jason Rhodes
    Here's the query: INSERT INTO jobemails (jobid, to, subject, message, headers, datesent) VALUES ('340', '[email protected]', 'We\'ve received your request for a photo shoot called \'another\'.', 'message', 'headers', '2010-04-22 15:55:06') The datatypes are all correct, it always fails at the subject, so it must be how I'm escaping the values, I assume. I'm sure one of you will see my idiot mistake right away. A little help?

    Read the article

  • Query a SharePoint List from InfoPath web form in code

    - by dawsonweb
    I'm writing an InfoPath web form, using C# code behind. The form is a holiday request, after the user inputs the start and end dates I want the code to query a bank-holiday sharepoint list and count occurrences between the dates. I've added the sharepoint list as a second datasource however I'm now stuck. Any ideas?

    Read the article

  • SQL query joining rows with same value

    - by user1285737
    I need to write a query that creates a view that calculates the total cost of each sale, by considering quantity and price of each bought item. The view should return the debit and total cost. In the answer each debit-number should only occur once. Thanks in advance Table ITEM: ID NAME PRICE 118 Jeans 100 120 Towel 20 127 Shirt 55 Table DEBIT: DEBIT ITEM Quantity 100581 118 5 100581 120 1 100586 127 5

    Read the article

  • Need some help with a NHibernate Query

    - by cwap
    Hi all Say I got 3 entities: Business, Employee and Payment. A payment has a foreign key to an Employee, while the Employee has an foreign key to a business. Now, I want to create a query which gives me all payments for a given business. I really don't have a clue about how to do this - I guess I want something like: mySession.CreateCriteria<Payment>() .Add(Criterion.Expression.Eq(/* Employee_FK => Employee.Business_FK == BusinessID */); Any help would be greatly appreciated :)

    Read the article

  • how to do this in MySql Query??

    - by deep
    ID NAME AMT 1 Name1 1000 2 Name2 500 3 Name3 3000 4 Name1 5000 5 Name2 2000 6 Name1 3000 consider above table as sample. am having a problem in my sql query, Am using like this. Select name,amt from sample where amt between 1000 and 5000 it returns all the values in the table between 1000 and 5000, instead I want to get maximum amount record for each name i.e., 3 name3 3000 4 name1 5000 5 name2 2000

    Read the article

  • 4 table query / join. getting duplicate rows

    - by Horse
    So I have written a query that will grab an order (this is for an ecommerce type site), and from that order id it will get all order items (ecom_order_items), print options (c_print_options) and images (images). The eoi_p_id is currently a foreign key from the images table. This works fine and the query is: SELECT eoi_parentid, eoi_p_id, eoi_po_id, eoi_quantity, i_id, i_parentid, po_name, po_price FROM ecom_order_items, images, c_print_options WHERE eoi_parentid = '1' AND i_id = eoi_p_id AND po_id = eoi_po_id; The above would grab all the stuff I need for order #1 Now to complicate things I added an extra table (ecom_products), which needs to act in a similar way to the images table. The eoi_p_id can also point at a foreign key in this table too. I have added an extra field 'eoi_type' which will either have the value 'image', or 'product'. Now items in the order could be made up of a mix of items from images or ecom_products. Whatever I try it either ends up with too many records, wont actually output any with eoi_type = 'product', and just generally wont work. Any ideas on how to achieve what I am after? Can provide SQL samples if needed? SELECT eoi_id, eoi_parentid, eoi_p_id, eoi_po_id, eoi_po_id_2, eoi_quantity, eoi_type, i_id, i_parentid, po_name, po_price, po_id, ep_id FROM ecom_order_items, images, c_print_options, ecom_products WHERE eoi_parentid = '9' AND i_id = eoi_p_id AND po_id = eoi_po_id The above outputs duplicate rows and doesnt work as expected. Am I going about this the wrong way? Should I have seperate foreign key fields for the eoi_p_id depending it its an image or a product? Should I be using JOINs? Here is a mysql explain of the tables in question ecom_products +-------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+----------------+ | ep_id | int(8) | NO | PRI | NULL | auto_increment | | ep_title | varchar(255) | NO | | NULL | | | ep_link | text | NO | | NULL | | | ep_desc | text | NO | | NULL | | | ep_imgdrop | text | NO | | NULL | | | ep_price | decimal(6,2) | NO | | NULL | | | ep_category | varchar(255) | NO | | NULL | | | ep_hide | tinyint(1) | NO | | 0 | | | ep_featured | tinyint(1) | NO | | 0 | | +-------------+--------------+------+-----+---------+----------------+ ecom_order_items +--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+----------------+ | eoi_id | int(8) | NO | PRI | NULL | auto_increment | | eoi_parentid | int(8) | NO | | NULL | | | eoi_type | varchar(32) | NO | | NULL | | | eoi_p_id | int(8) | NO | | NULL | | | eoi_po_id | int(8) | NO | | NULL | | | eoi_quantity | int(4) | NO | | NULL | | +--------------+-------------+------+-----+---------+----------------+ c_print_options +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | po_id | int(8) | NO | PRI | NULL | auto_increment | | po_name | varchar(255) | NO | | NULL | | | po_price | decimal(6,2) | NO | | NULL | | +------------+--------------+------+-----+---------+----------------+ images +--------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+----------------+ | i_id | int(8) | NO | PRI | NULL | auto_increment | | i_filename | varchar(255) | NO | | NULL | | | i_data | longtext | NO | | NULL | | | i_parentid | int(8) | NO | | NULL | | +--------------+--------------+------+-----+---------+----------------+

    Read the article

  • SQL query construction - separate data in a column into two columns

    - by Tommy
    I have a column that contains links. The problem is that the titles of the links are in the same column, so it looks like this: linktitle|-|linkurl I want link title and linkurl in separate columns. I've created a new column for the urls, so I'm looking for a way to extract them and update the linkurl column with them. Is there any clever way to construct a query that does this?

    Read the article

  • help with sql-server query - dates

    - by Gold
    hi i have this table: id|date 1 | 10/11/2009 2 | 13/11/2009 1 | 20/12/2009 3 | 21/12/2009 1 | 30/12/2009 if i stand on the last record (id=1) and i need to see the last date where id=1 is appear -- will show me: 1 | 20/12/2009 what query will do it ? thank's in advance

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >