mysql

having condition on result of a subquery in mysql

hi i am trying to run a query like this SELECT a, b , c, (SELECT INNULL(x,y)) as mycol WHERE mycol < 400 ; BUt it gives the error #1054 - Unknown column 'mycol' in 'where clause' What would be the right way to do this? Thanks. ...

migrate a portion of a mysql table to SQLite

I have a mysql table set up like so: user_id | document 44 [blob] 44 [blob] 44 [blob] 46 [blob] I'd like to export all of user_id 44's data to an SQLite3 file. Best way to go about this without writing a script that reads the data and dumps it into a SQLite file? ...

select similar values from mysql database

Hi I have several data s in MySQL database. In my table there is a column called rank. what I want is when some one enter a rank say 25 then the result should display names on similar(+ or -) ranks LIMIT to 10 from table. example mathew - 25 john - 26 joe - 25 stewart - 27 kelly - 24 brandon -23 magy - 22 .......etc. Thanks Mathew ...

prob. with tquery.requestlive

Hi, Do anyone know how to request a "live result set" in MySql when query has offset(eg: select * from table limit 10 offset 20;). it is throughing an error like 'invalid use of keyword' . Thanks, Vijay. ...

What should a PHP/MySQL web developer know about servers?

I develop websites using PHP and MySQL. What resources would a seasoned web developer recommend that would cover server-specific information relevant to the job of a developer. If it helps, I work specifically with an Apache server (through my hosting company). ...

How do I display a quote for 24 hours

I want to display a quote on my site for daily basis. after 24 hours it should change. quotes are stored in MySQL database. how do I do this with PHP Thanks Mathew ...

"Remember" last three MySql queries; Cookie, passed variable or other method?

I have a classified website, with pretty sophisticated searching, and I am about to implement a function where the last three queries is displayed for the user, so that the user can go back easier through the queries. This because for each query the user has to provide a lot of input. I have four questions for you: I wonder, how can I...

How do I show todays top search list??

I owns a website which is doing lots of searches per day. these search results are stored in my MySQL databse. what I want is I want retrieve today's top searches from MySQL limit to 20 and display in my website. how do I do this with PHP & MySQL?? Thanks Mathew ...

mysql query execution time - can i get this in milliseconds?

I'm comparing a few different approaches to getting some data in mysql, directly at the console, using the SQL_NO_CACHE option to make sure mysql keeps running the full query every time. Mysql gives me the execution time back in seconds, to two decimal places. I'd really like to get the result back in milliseconds (ideally to one or tw...

advanced search with mysql

I'm creating a search function for my website where the user can put in anything he likes in a textfield. It get's matched against anything (name, title, job, car brand, ... you name it) I initially wrote the query with an INNER JOIN on every table that needed to be searched. SELECT column1, column2, ... FROM person INNER JOIN person_c...

Want to avoid the particular rows from select join query... See description

I have a Select Left Join Query whis displays me the rows for the latest changedone(its a time) column name ("field" should not be equal) column name ("trackid" should not be equal), and column name "Operation should be "UPDATE" ", below is the query I am talking about... SELECT j1. * FROM jos_audittrail j1 LEFT OUTER JOIN jos_audittrai...

mysql phpmyadmin accepting 4 character but its real length is int 2

Hi , i have employee table and its empid length is INT 3 , But it accepting more then 3 character .... How it is possible (THIS IS TESTED IN PHPMYADMIN) ...

How do I control retrieving data from tables in a database

I do have multiple tables in single database. when my page loads it retrieve data s from all tables in this database. because of this my page is getting slow due to different loading time in different tables. my question is how do I display page with data which is loaded already from tables and rest is in a streaming mode?? I don't know ...

Mysqli results memory usage

Why is the memory consumption in this query continuing to rise as the internal pointer progresses through loop? How to make this more efficient and lean? $link = mysqli_connect(...); $result = mysqli_query($link,$query); // 403,268 rows in result set while ($row = mysqli_fetch_row($result)) { // print time, (get memory usage), -- ...

How do I export a large table into 50 smaller csv files of 100,000 records each

I am trying to export one field from a very large table - containing 5,000,000 records, for example - into a csv list - but not all together, rather, 100,000 records into each .csv file created - without duplication. How can I do this, please? I tried SELECT field_name FROM table_name WHERE certain_conditions_are_met INTO OUTFILE ...

Using Hibernate's ScrollableResults to slowly read 90 million records

I simply need to read each row in a table in my MySQL database using Hibernate and write a file based on it. But there are 90 million rows and they are pretty big. So it seemed like the following would be appropriate: ScrollableResults results = session.createQuery("SELECT person FROM Person person") .setReadOnly(true).set...

Test the sequentiality of a column with a single SQL query

Hey, I have a table that contains sets of sequential datasets, like that: ID set_ID some_column n 1 'set-1' 'aaaaaaaaaa' 1 2 'set-1' 'bbbbbbbbbb' 2 3 'set-1' 'cccccccccc' 3 4 'set-2' 'dddddddddd' 1 5 'set-2' 'eeeeeeeeee' 2 6 'set-3' 'ffffffffff' 2 7 'set-3' 'gggggggggg' 1 At the end of a transaction that makes several type...

delete all records except the id I have in a python list

Hi all, I want to delete all records in a mysql db except the record id's I have in a list. The length of that list can vary and could easily contain 2000+ id's, ... Currently I convert my list to a string so it fits in something like this: cursor.execute("""delete from table where id not in (%s)""",(list)) Which doesn't feel right an...

MYSQL variables - SET @var

I am attempting to create a mysql snippet that will analyse a table and remove duplicate entries (duplicates are based on two fields not entire record) I have the following code that works when I hard code the variables in the queries, but when I take them out and put them as variables I get mysql errors, below is the script SET @tblna...

Most watched videos this week

I have a Youtube like web-page where users upload&watch videos. I would like to add a "most watched videos this week" list of videos to my page. But this list should not contain just the videos that ware uploaded in the previous week, but all videos. I'm currently recording views in a column, so I have no information on when a video wa...