mysql

Is this the correct way to sort rows which have the same insert datetime ?

When I execute a query from my application (Java JDBC), it is returning the row with seq 83 first. But I want the row with seq 84. seq | dtCreated | 84 | 2009-09-14 16:16:23 | 83 | 2009-09-14 16:16:23 | 82 | 2009-09-14 16:15:01 | Is this query correct ? I'm interpreting this to mean that if there are ties in dtCre...

Four items in a recordset group in MySQL

How to fetch some items order by a field in each group, grouped by 'group by'. like this: SELECT (four items in each product_type GROUP) FROM products GROUP BY product_type ORDER BY product_price. ...

Using Prolog ODBC Interface

Hi Guys, I am just learning prolog. I have a task ahead. I have to insert some data in to a database like mysql or MSSQL using Prolog ODBC INterface. I know there are some example predicates(SWI-PROLOG) like open_wordnet :- odbc_connect('WordNet', _, [ user(jan), password(xxx), ...

MySQL utf8_general character mapping table

From what I understand, when MySQL compares a string stored in utf8_general collation, it first converts it's characters to their ascii equivalents. In other words ḩ = h, ţ = t, ā = a, í = i, etc... Is there a mapping table which I could use to implement similar comparison function in php or javacript? I know there are alternatives in p...

Is there a way to condense a few different queries (almost identical) into one?

I have about 4 or 5 different queries that are all exactly like with the exception of what is contained in the WHERE clause. For example, these are reports that operate by date so one report uses a date of Now() and the other reports use dates by month and 15 days. All of the fields are exactly the same. Is there a way to combine these i...

How do I make an SQL statement to return all rows when a variable is blank, otherwise return only matches

How do I use an SQL statement to return all rows if the input parameter is empty, otherwise only return rows that match? My SQL looks like this where person.personstatusuid = @StatusUID AND person.forename != '' AND person.location = @Location but I want basically, person.location = @Location OR @Location is b...

Can't connect to MySQL server error 111

I installed mysql server on linux box IP = 192.168.1.100 but when i try to connect to this IP it alway error(111). but use localhost and 127.0.0.1 is OK. beer@beer-laptop# ifconfig | grep "inet addr" inet addr:127.0.0.1 Mask:255.0.0.0 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 beer@beer-lapto...

Find out which tables were affected by Triggers

In MySQL (particularly InnoDB) is there any way to know which tables were affected (updated / deleted rows) by CASCADE UPDATES / DELETES or regular triggers? ...

MySQL DATE_ADD does not work

I have two columns: beginTime and duration. I'm trying to calculate the endTime. The problem is that i get empty results back. I have tried several things. DATE_ADD(startTime, INTERVAL `duration` MINUTE) AS endTime DATE_ADD(startTime, INTERVAL '10' MINUTE) AS endTime DATE_ADD(startTime, INTERVAL 10 MINUTE) AS endTime But everytime ...

Files required for dbexpress application to access mysql databases

Hello Folks, Which additional files are needed to deploy a delphi dbexpress based application to get access to mysql databases. I can't find any information about it. Thanks in advance. ...

VS2008 MySQL Connector/NET AccessViolationException

I've been struggling for weeks with relentless errors thrown either by VS2008 or MySQL Connector/NET. These errors appear sort of randomly while messing with Visual Studio's Dataset Designer and, as soon as it starts, it won't stop; It even prevents from saving the XSD file. A pop-up shows: Attempted to read or write protected memor...

Can I JOIN a table based on an SQL if-statement?

I have three tables being used for this problem: songs, blacklist, and whitelist. The songs table has a column named "accessType" which stores one of these four values: public, private, blacklist, whitelist. I'm trying to fetch a list of all the songs a user may access. The first condition is that songs.accessType != private. Here comes ...

custom reports for ilias LMS

I am working with a Learning Management system called Ilias (http://www.ilias.de/). I have a request from to generate a custom report that will break down all the users and the scores for each question. Does any one know where I can find this information in the data base? There is currently no database models built, so its difficult ...

using MySql.Data.MySqlClient; is not worked

some time before i use ms sql but in new project i use mysql so when i run our application then i have a error that Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compi...

mysql return rows matching year month

How would I go about doing a query that returns results of all rows that contain dates for current year and month at the time of query. Timestamps for each row are formated as such: yyyy-mm-dd I know it probably has something to do with the date function and that I must somehow set a special parameter to make it spit out like such:...

MYSQL Multiple Select For Same Category?

I have 3 tables (scenes, categories, scenes_categories ) in a many to many relationship. scenes ( id, title, description ) categories ( id, title ) scenes_categories ( scene_id, category_id ) I'm having problems making a query to select scenes that must match multiple categories. For example, I might want to select scenes that match ca...

In MySql how do I get row duplication for the case where I pass duplicate IDs in a list?

For this MySQL SELECT statement: SELECT * FROM MY_TABLE WHERE ID IN(x,y,y,z): I want 4 rows back - ie I WANT row duplication for the case where I pass duplicate IDs in the list. Is this possible? ...

How can you access a MySQL database from the web without using a servlet or PHP?

I'm currently using a hosting service that offers users access to MySQL databases, but does not offer a Tomcat server or any other way to perform server side processing. So a three tier design is out. Being a novice in Java and Javascript I was planning on using them on this project to gain more experience. I know nothing about PHP, wh...

MySQL Update column with statement

Hi everyone, I would like to do something like the following UPDATE table SET column = other_column IN(complex_statement) My question is whether this wold cause the complex statement to be evaluated for each row or not, which would obviously not very good for performance. The alternative would be doing UPDATE table SET column = 0; ...

Generating PHP/MySQL Reference ID

In PHP/MySQL, what's the best way to generate a unique reference ID so that when a person submits his info to the database, he gets a reference number to follow up with his request? I am already using the auto-increment feature from the database since the data needs to be unique every time a user submits information, but then I need to ...