Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: hvass
  • Order by date
  1. hvass

    Mysql Query - Different Servers

    why not use the mysql replication server http://dev.mysql.com/doc/refman/5.1/en/replication.html seems little point in writing your own script
  2. hvass

    General Query Log - in Winderz Land

    Probably considered trivial so there may not be a way of doing this, even if there is it is probably easier to Either - Convert the file executables like unix2dos one liners like perl, awk write your own ftp Or - better still use a better editor paid for - uedit / editplus free -...
  3. hvass

    Using LIKE for matching

    Matching records is what a database does so your approach to read a line from a file then form a sql query, submit the query, read the result is a bit of long way around. Depending on the relative size of the fopen file vs the database table Either load your file (that you were reading line by...
  4. hvass

    Graphical reports

    Dont discount the obvious GDChart. http://pecl.php.net/package/GDChart
  5. hvass

    Mounting a database

    I cannot see any reason this would not work... but sounds suspiciously like a permissions problem ... may be the way you are approaching this. The location of the database files is controlled by a variable that can be set in the my.cnf or on the command line ... look for datadir=. So while...
  6. hvass

    slow sql query on lg indexed table

    DonQuichote >>Now this is funny. MySQL knows that two indexes can be used and uses neither of them! I think this is to be expected the indexes may well be larger than the data so scanning the table is probably easier than using the indexes.
  7. hvass

    slow sql query on lg indexed table

    Interesting problem... First indexing might not always increase speed of access.. You should consider using partitions... Not sure there is an easy answer other than trying a few different approaches.... You may notice that simply scanning the full table works pretty well. You say your data...
  8. hvass

    Is this the best way to schedule a task?

    Yup this is the right approach. You might want to consider setting up a special user who only has specific rights on specific tables from a specific host rather than use root. You could set up a simple script with the mysql command in that cron calls and then chmod the file to restrict access.
  9. hvass

    How to slice data (groupped by row counts)

    You need to create a sequence number then use this to group into sets of 2. There are a couple of ways of generating a sequence number either use auto_increment field or use a variable and increment it yourself @counter:=@counter+1 This means you can do something like this drop table if...
  10. hvass

    Get embedded number from varchar field?

    You really need something like regexp_like not available in regular MySQL but various flavours available as udf's try http://udf-regexp.php-baustelle.de/trac/
  11. hvass

    meanof(var1,var2,var3)

    Mufasa Many thanks great that answer is so simple - I thought I would have a problem generalising this to be any number of columns meanof(col1,col2,col3) meanof(col1,col2,col3,col4) so was thinking I would have to pass in a string that I then parse it. Thanks for sticking with me.
  12. hvass

    meanof(var1,var2,var3)

    Thanks Mufasa Realise my original post was not very clear. Yes want to do something very similar but rather than pass in constants to the function 2,4,6 I want to pass in column names col1,col2,col3 so select * from mytable returns col1,col2,col3 2,4,6 6,8,10 select meanof(col1,col2,col3)...
  13. hvass

    meanof(var1,var2,var3)

    I am trying to write a function that will take the average of a number of columns (rather than average of column in a number of rows)(trying to ghost a SAS function called mean) select meanof('var1,var2,var3') from mytable on data (var1,var2,var3) 2,4,6 6,8,10 would return...
  14. hvass

    inserting null into a year field

    if your column year is defined as having NULL then you would just go INSERT INTO TABLE (firstname, lastname) VALUES ('$_POST[firstname]','$_POST[lastname]'); and the value of year would be [NULL] (you should really think of a better name than year which is probably a reserved word)
  15. hvass

    MySQL no incoming connections - missing config file

    Yes The example config files have some explanation of what they are. Assuming you are running a simple server the main section to look at and understand is [mysqld] and within this check the basedir datadir tmpdir point to the correct directories.
  16. hvass

    MySQL no incoming connections - missing config file

    No experience of Fedora all distros are slightly different in where they put things and the RPM might have reflected that. Would be surprised if there was not a my.cnf somewhere have you searched for it with find. Suspect it might be the script that starts the server that is passing parameters...
  17. hvass

    converting MS Sql server query to mysql query

    What you need is reg expression and replace ... not available in standard MySQL Available as a UDF from http://mysqludf.com/lib_mysqludf_preg/index.php#PREG_REPLACE_SECTION Otherwise you are stuck doing something ugly like if(ascii(substring(message,1,1)) between 65 and...
  18. hvass

    Loading Data into MySQL from a Text File

    Dont worry it is straight forward... only complication is coming from the fact that you dont control the server it is hosted on 1.& 2. You need to complete a mysql command with ; try no 1 again 3. I dont think is the way to go as you noticed phpmyadmin uses a temporary file - dont assume you...
  19. hvass

    Loading Data into MySQL from a Text File

    ls -all only lists files in the current directory cd to csvfiles and do again, you probably need something like ... LOAD DATA INFILE "/kxxxxx/homepages/99/d1xxxxxxx8/csvfiles/employees.csv" INTO TABLE employee FIELDS TERMINATED BY "," LINES TERMINATED BY "\r\n";
  20. hvass

    convert password hash?

    grant is the mechanism for setting the various values in all the permissions tables if you are using the mysql permissions system to control access to the database then this is what you should use if you only wanted users to be able to select from one table (thetable) and not insert update...

Part and Inventory Search

Back
Top