mysql

SQL Join query help

Hi I have 2 tables A and B with the following columns Table A - id,bId,aName,aVal Table B - id,bName where A.bId is the same as B.id. I want a result set from a query to get A.id, A.aName, B.bName where A.bId=B.id OR A.id, A.aName, "" when A.bId=0. In both cases, only those records should be considered where A.aVal LIKE "aVal" Can ...

MySQL log files deletion

I have a master and slave database running on different nodes. The master DB is subjected to huge no. of inserts/updates. The master DB size is close to 6 GB, while the log files are now occupying a space of more than 120 GB. I am running out of disk space and need to get rid of the log files. Will deleting the log files in anyway affec...

Querying results on timestamp in mysql

Hi, I have series of records in a table called 'hits' and each record has the current_timestamp (ie. 2010-04-30 10:11:30) in a column called 'current_time'. What I would like to do is query these records and return only the records from the current month. I cannot seem to get this to work. I have tried a range of queries that don't w...

How to migrate data from FoxPro to MySQL

I am having a database in .dbf (FoxPro) format. How to retrieve data from FoxPro using Java? If the data can be migrated to MySQL, How to do the conversion? ...

SQL tables using VARCHAR with UTF8 (with respect to multi byte character length)

Like in Oracle VARCHAR( 60 CHAR ) I would like to specify a varchar field with variable length depending on the inserted characters. for example: create table X (text varchar(3)) insert into X (text) VALUES ('äöü') Should be possible (with UTF8 as the default charset of the database). On DB2 I got this Error: DB2 SQL Error: SQLCODE...

SQL Replace Into question

With Replace Into, if I have two fields. FirstName LastName. The table has John Smith in it, if I was to run REPLACE INTO tblNames (FirstName, LastName) VALUES (John, Jones) Would that replace Smith with Jones, or create a new name? What determines if its an Update or and Insert? ...

LinkDemand error on webserver when using TraceSource

Hi, On a webserver (shared hosting provider) I published a website with a ADO.Net Framework model in use with MySql Connector 6.3.1. When I request a page, a Security Exception will be happen with this error messages: "LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone o...

Use WampServer's MySQL as a real MySQL for going on the net.

Is this a right thing to do? I am using the Apache/Tomcat that comes with the liferay portal bundle and I used the MySQL that comes with WampServer at home but now I want to transfer my portal to a real Server and I wanted to know whether I could still use the Wamp's MySQL or should I install a real MySQL (What's the difference?) Thanks ...

Which collation should I use to store these country names in MySQL?

I am trying to store a list of countries in a mySQL database. I am having problems storing (non English) names like these: São Tomé and Príncipe República de El Salvador They are stored with strange characters in the db, (and therefore output strangely in my HTML pages). I have tried using different combinations of collations for t...

Query multiple currencies

I need store multiple currencies on my database... Here's the problem: Example Tables: [ Products ] id (INT, PK) name (VARCHAR) price (DECIMAL) currency (INT, FK) [ Currencies ] id (INT, PK) name (VARCHAR) conversion (DECIMAL) # To U$ I'll store the product price with the currency selected by the user... Later I need to search the ...

Is there a single query that can update a "sequence number" across multiple groups?

Given a table like below, is there a single-query way to update the table from this: | id | type_id | created_at | sequence | |----|---------|------------|----------| | 1 | 1 | 2010-04-26 | NULL | | 2 | 1 | 2010-04-27 | NULL | | 3 | 2 | 2010-04-28 | NULL | | 4 | 3 | 2010-04-28 | NULL | To th...

Error in connecting to MySql Host

Can anyone tell me on how this error arise? 'Unable to connect to any of the specified MySQL hosts.' ...

mysql query to find every occurrence of a non-ascii character in a table column and replace it with its HTML equivalent

I have a column that contains HTML strings and has characters like ® and ™ in it. I want to replace all such characters with their HTML equivalent. Is this possible? ...

How do I restart mysql and where is my.cnf file

I am using snow leopard mac. I installed mysql on my machine using instructions mentioned here. Everything works great. However I have two questions. 1) Where is my.cnf file? I searched the whole file system and result is empty. Is it possible that there is no my.cnf and mysql works with default values. If yes then probably I should cr...

Can "Distinct" key Word be used twice in a single Select Query?

Can "Distinct" key Word be used twice in a single Select Query? like wise: select DISTINCT(trackid), DISTINCT(table_name) from jos_audittrail where live = 0 AND operation = UPDATE Thanks ...

Extremely slow insert from Delphi to Remote MySQL Database

Having a major hair-pulling issue with extremely slow inserts from Delphi 2010 to a remote MySQL 5.09 server. So far, I have tried: ADO using MySQL ODBC Driver Zeoslib v7 Alpha MyDAC I have used batching and direct insert with ADO (using table access), and with Zeos I have used SQL insertion with a Query, then used Table direct mode...

Bind any version of MySql.Data using the app.config

How do I bind any version or a range of versions of an assembly by using the app.config? I'm currently binding the MySql.Data assembly like this: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" applies-to="v2.0.50727"> <qualifyAssembly partialName="MySql.Data" fullName="MySql.Data, Ve...

How to use external apache htdocs and mysql data directory outside the xampp directory in xampp 1.7.0?

I am using xampp 1.7.0 and simply want to use directories outside of the xampp directory as apache htdocs and mysql data directory. I've googled it and found many solutions but none of them are working in my pc! ...

mysql to excel exporting data using php getting html code also

if( ($_POST['Submit']=='generateexcel')) { $tblname=$_GET['generateexcel']; global $obj_mysql; $table="tbl_js_login"; function exportMysqlToCsv($table,$filename = 'export.csv') { $csv_terminated = "\n"; $csv_separator = ","; $csv_enclosed = '"'; $csv_escaped = "\\"; $sql_query = "select fld_id, fld_fname,fld_lname...

Fulltext search on many tables

I have three tables, all of which have a column with a fulltext index. The user will enter search terms into a single text box, and then all three tables will be searched. This is better explained with an example: documents doc_id name FULLTEXT table2 id doc_id a_field FULLTEXT table3 id doc_id another_field FULLTEXT ...