Search Results

Search found 14874 results on 595 pages for 'mysql connector'.

Page 115/595 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • How can I allow NULL values in MySQL

    - by peakUC
    I was wondering how can I allow NULL values in the following code below along with keeping WHERE username = '$username'. here is the mysql code. "SELECT * FROM users WHERE username = '$username' AND user_id <> '$user_id'" I'm trying to check for usernames with the same username but I want all users to have a NULL value if they want.

    Read the article

  • MySQL regexp on Indexes

    - by Vivek
    HI, I have query having multiple regexp in where clause. The coloumns contained in the where clause have already been indexed. But the query is not using the indexes. Does MySql regexp cause use of indexes ? If not, what could be the workaround for this ?

    Read the article

  • Does MySQL short-circuit the ORDER BY clause?

    - by nickf
    Given this SQL: SELECT * FROM mytable ORDER BY mycolumn, RAND() Assuming that mycolumn happens to only contain unique values (and hence, contains enough information to perform the ORDER BY), does MySQL short-circuit the operation and skip evaluating the rest?

    Read the article

  • Friendfeed schemaless data in MYSQL

    - by John Stewart
    I read an article around schema-less database which sounds cool. (http://bret.appspot.com/entry/how-friendfeed-uses-mysql) But what isn't clear to me is how do they run search queries on this data? Since the data is in JSON format how do we look for it?

    Read the article

  • MySQL query to order by parent then child places

    - by Swanny
    I have a table of pages in my database, each page can have a parent as below: id parent_id title 1 0 Home 2 0 Sitemap 3 0 Products 4 3 Product 1 5 3 Product 2 6 4 Product 1 Review Page What would be the best MySQL query to select all pages ordered by parent then child then child again if there is more than one level, there will be a maximum of three levels. The above example would produce the desired order: Home Sitemap Products Product 1 Product 1 Review Page Product 2

    Read the article

  • Mysql count columns

    - by Sergio
    I have a table for image gallery with four columns like: foid | uid | pic1 | pic2 | pic3 | date | ----------------------------------------------- 104 | 5 | 1.jpg | 2.jpg | 3.jpg | 2010-01-01 105 | 14 | 8.jpg | | | 2009-04-08 106 | 48 | x.jpg | y.jpg | | 2010-08-09 Mysql query for the user's galleries looks like: SELECT * FROM foto WHERE uid = $id order by foid DESC The thing that I want to do is count the number of images (PIC1, PIC2, PIC3) in every of the listed galleries. What is the best way for doing that?

    Read the article

  • How can I view live MySQL queries?

    - by barfoon
    Hey all, I am just wondering if its possible to trace MySQL queries on my linux server as they happen? For example I'd love to set up some sort of listener, then request a web page and view all of the queries the engine executed, or just view all of the queries being run on a production server. Are there tools to do this? Thank you,

    Read the article

  • Slow MySQL query....only sometimes

    - by Shane N
    I have a query that's used in a reporting system of ours that sometimes runs quicker than a second, and other times takes 1 to 10 minutes to run. Here's the entry from the slow query log: # Query_time: 543 Lock_time: 0 Rows_sent: 0 Rows_examined: 124948974 use statsdb; SELECT count(distinct Visits.visitorid) as 'uniques' FROM Visits,Visitors WHERE Visits.visitorid=Visitors.visitorid and candidateid in (32) and visittime>=1275721200 and visittime<=1275807599 and (omit=0 or omit>=1275807599) AND Visitors.segmentid=9 AND Visits.visitorid NOT IN (SELECT Visits.visitorid FROM Visits,Visitors WHERE Visits.visitorid=Visitors.visitorid and candidateid in (32) and visittime<1275721200 and (omit=0 or omit>=1275807599) AND Visitors.segmentid=9); It's basically counting unique visitors, and it's doing that by counting the visitors for today and then substracting those that have been here before. If you know of a better way to do this, let me know. I just don't understand why sometimes it can be so quick, and other times takes so long - even with the same exact query under the same server load. Here's the EXPLAIN on this query. As you can see it's using the indexes I've set up: id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Visits range visittime_visitorid,visitorid visittime_visitorid 4 NULL 82500 Using where; Using index 1 PRIMARY Visitors eq_ref PRIMARY,cand_visitor_omit PRIMARY 8 statsdb.Visits.visitorid 1 Using where 2 DEPENDENT SUBQUERY Visits ref visittime_visitorid,visitorid visitorid 8 func 1 Using where 2 DEPENDENT SUBQUERY Visitors eq_ref PRIMARY,cand_visitor_omit PRIMARY 8 statsdb.Visits.visitorid 1 Using where I tried to optimize the query a few weeks ago and came up with a variation that consistently took about 2 seconds, but in practice it ended up taking more time since 90% of the time the old query returned much quicker. Two seconds per query is too long because we are calling the query up to 50 times per page load, with different time periods. Could the quick behavior be due to the query being saved in the query cache? I tried running 'RESET QUERY CACHE' and 'FLUSH TABLES' between my benchmark tests and I was still getting quick results most of the time. Note: last night while running the query I got an error: Unable to save result set. My initial research shows that may be due to a corrupt table that needs repair. Could this be the reason for the behavior I'm seeing? In case you want server info: Accessing via PHP 4.4.4 MySQL 4.1.22 All tables are InnoDB We run optimize table on all tables weekly The sum of both the tables used in the query is 500 MB MySQL config: key_buffer = 350M max_allowed_packet = 16M thread_stack = 128K sort_buffer = 14M read_buffer = 1M bulk_insert_buffer_size = 400M set-variable = max_connections=150 query_cache_limit = 1048576 query_cache_size = 50777216 query_cache_type = 1 tmp_table_size = 203554432 table_cache = 120 thread_cache_size = 4 wait_timeout = 28800 skip-external-locking innodb_file_per_table innodb_buffer_pool_size = 3512M innodb_log_file_size=100M innodb_log_buffer_size=4M

    Read the article

  • mySQL 1046 error when importing wordpress database

    - by j-man86
    I'm moving a locally developed wordpress site to a client's server so I'm trying to export the local database and import it to the server. I exported the .sql file according to the instructions here http://codex.wordpress.org/Backing_Up_Your_Database but I keep getting this error when importing: DROP TABLE IF EXISTS `wp_commentmeta` ; MySQL said: Documentation #1046 - No database selected Any help very much appreciated. Thanks!

    Read the article

  • Question regarding MySQL indices and their functionality

    - by user281434
    Hi Say I have an ordinary table in my db like so ---------------------------- | id | username | password | ---------------------------- | 24 | blah | blah | ---------------------------- A primary key is assigned to the id column. Now when I run a Mysql query like this: SELECT id FROM table WHERE username = 'blah' LIMIT 1 Does that primary key index even help? If I am telling it to match usernames, then shouldn't the username column be indexed instead? Thanks for your time

    Read the article

  • MySQL: What's the best to use, Unix TimeStamp Or DATETIME

    - by Axel
    Hello, Probably many coders want to ask this question. it is What's the adventages of each one of those MySQL time formats. and which one you will prefer to use it in your apps. For me i use Unix timestamp because maybe i find it easy to convert & order records with it, and also because i never tried the DATETIME thing. but anyways i'm ready to change my mind if anyone tells me i'm wrong. Thanks

    Read the article

  • mysql insert data from multiple select queries

    - by daulex
    What I've got working and it's what I need to improve on: INSERT form_data (id,data_id, email) SELECT fk_form_joiner_id AS data_id, value AS email FROM wp_contactform_submit_data WHERE form_key='your-email' This just gets the emails, now this is great, but not enough as I have a good few different values of form_key that I need to import into different columns, I'm aware that I can do it via php using foreach loops and updates, but this needs to be done purely in mysql. So how do I do something like: insert form_data(id,data,email,name,surname,etc) Select [..],Select [..].... Please help

    Read the article

  • APE engine Mysql push data to channel on insert

    - by Fotis
    Hello, i am working with APE Engine (http://www.ape-project.org) and up until now i had no actual problem. The problem is that i would like to use the MySQL module and push data to a channel each time a row is inserted into a table. I've tried to setup a server side module, i created an SQL query but data is fetched only when the server boots. How can i make this work?

    Read the article

  • Create Chart using PHP-MySQL

    - by Ajith
    I have a mysql table - request_events with three fields; request_eventsid,datetime,type.this table will track all the activities of my website day wise and also type wise.thus,type may be 1 or 2.I need to display an open-chart for understanding the progress.So I need to retrieve the ratio of type2/type1 as input day wise.How can I get all these input for last 30 days from this table.Please give me some idea....It already kill my week end.Please help me

    Read the article

  • Deceptive MySQL Query

    - by jerebear
    So I don't consider myself a novice at MySQL but this one has me stumped: I have a message board and I want to pull a list of all the most recent posts grouped by the Thread ID. Here's the table: MB_Posts -ID -Thread_ID -Created_On (timestamp) -Creator_User (user_id) -Subject -Contents -Edited (timestamp) -Reported I've tried many different things to keep it simple but I would like help from the community on this one. Just to kick this out there...this one does not work as expected: SELECT * FROM MB_Posts GROUP BY Thread_ID ORDER BY ID DESC

    Read the article

  • MySQL SUM Query daily values of a week problem

    - by davykiash
    Am trying to return the sum of each day of a week in mysql but it returns nothing despite having values for the 3rd Week of March 2010 SELECT SUM(expense_details_amount) AS total FROM expense_details WHERE YEAR(expense_details_date) = '2010' AND MONTH(expense_details_date) = '03' AND WEEK(expense_details_date) = '3' GROUP BY DAY(expense_details_date) How do I go about this?

    Read the article

  • Saving auto increment in MySQL

    - by oshafran
    Hello, I am trying to sync between 2 tables: I have active table where has auto_increment, and I have archive table with the same values. I would like both ID's to be unique (between the tables as well) - I mean, I would like to save auto incremenet, and if I UNION both table I still have uniqness. How can I do that? Is there a possibility to save auto increment when mysql is off?

    Read the article

  • MySQL Optimization 20 gig table

    - by user169743
    I have a 20 gig table that has a large amount of inserts and updates daily. This table is also frequently searched. I'd like to know if the MySQL indices can become fragmented and perhaps need to be rebuilt or something similar. I'm finding it difficult to figure out which of the CHECK TABLE, REPAIR TABLE or something similar? Any guidance appreciated, I'm a db newb.

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >