mysql

PHP/MYSQL query help with grouping results

I have a MYSQL table with 3 fields: CODE, DATE, COUNT. CODE is the ID of the client DATE is the date the entry was added COUNT is the number of credits used by that client on that date I need to be able to know how many credits each client has used on a per month basis. So I need to group the results by client and by year/month. Basic...

adding auto-generated date/time stamp to a mapped collection of Strings (hibernate annotations)

Hello, I am using annotations to map a basic collection of Strings to an existing entity like this: Inside the parent entity class: @org.hibernate.annotations.CollectionOfElements @JoinTable (name="GoalToAchieve_entry", joinColumns=@JoinColumn(name="goalToAchieve_id")) @org.hibernate.annotations.Sort(type = org.hibernate.annotations.S...

Subsonic not working with MySQL (5.0.51a)

I am trying to use Subsoinc 3.0.0.1 to connect to mysql db. I added dll reference and connection string to app.config Then I copied templates from ActiveRecord folder to folder in my solution and edited namespace and connection string but then i get this error: Error 10 Running transformation: System.Data.SqlClient.SqlException: A...

Hibernate Save strange behaviour

I have a user object that has a one-to-many relationship with String types. I believe they are simple mappings. The types table hold the associated user_id and variable type names, with a primary key 'id' that is basically a counter. <class name="Users" table="users"> <id column="id" name="id" /> ... <set name="types" table=...

visual basic 2005 & mySQL

do u need to download something for VB2005 to connect to a mySQL db? cant connect to mysql db? any suggestions? ...

MySQL: NULL vs ""

Is it better to use default null or default "" for text fields in MySQL? Why? Update: I know what means each of them. I am interested what is better to use considering disk space and performance. Update 2: Hey ppl! The question was "what is better to use" not "what each means" or "how to check them"... ...

MySQL: get how many entrys for each id on each date?

I have a table with an associate_id and date fields. I want to get how many the associates have for each date. For example if this was my Table: date associate_id 2009-07-08 10 2009-07-08 113 2009-07-09 113 2009-07-09 113 I want results like this: date associate_id per_date 2009-07-08 10 1 2009-07-08 113 ...

Advanced (?) AND / OR query

For quite a simple table structure, ie. Person, Criteria, and PersonCriteria (the combi-table), I have set up a query at the moment that selects all persons that possess all selected criteria. The query itself looks like this at the moment: SELECT p.PersonID FROM Person p, ( SELECT DISTINCT PersonID, CriteriaID ...

How to parse XML in order to extract data from MySQL Database.

Hello Here is a simple form to send to admin_xml.php <form name="review" action="admin_xml.php" method="post"> <textarea name="xml" cols="40" rows="10"></textarea> <input class="submit" type="submit" value="Submit Request"> </form> Here is the XML which I want to enter into the form to extract Data from MySQL Database. <?xml ver...

Sequel + Sinatra + Phusion Passenger + MySQL Connection Management

We are using Sinatra and Sequel for a small API implementation. The problem we have however is that on every page request Sequel opens new connections to MySQL, and keeps them open till they timeout, or you restart Apache. There's not a lot of documentation on how to reuse connections, so any help, explanations, and/or pointers in the r...

Multiple processes accessing Django db backend; records not showing up until manually calling _commit

I have a Django project in which multiple processes are accessing the backend mysql db. One process is creating records, while a second process is trying to read those records. I am having an issue where the second process that is trying to read the records can't actually find the records until I manually call connection._commit(). Th...

looking for a more pythonic way to access the database

I have a bunch of python methods that follow this pattern: def delete_session(guid): conn = get_conn() cur = conn.cursor() cur.execute("delete from sessions where guid=%s", guid) conn.commit() conn.close() Is there a more pythonic way to execute raw sql. The 2 lines at the beginning and end of every method are st...

Doctrine_RawSql custom Select

I having problems to generate a doctrine_rawsql with a custom select. this is my rawsql $distance = glength(linestringfromwkb(linestring(asbinary(GeomFromText('POINT( FLOAT('30') FLOAT('-3')),asbinary({l.point})))) as distance $q->select($distance) ->from('place p INNER JOIN location l ON p.location_id = l.id') ...

mySQL search in multiple Rows ...

I have a Table : | USERNAME | FORNAME | SURNAME | TELNUMBER | ZIPCODE .... and i want to search username forename and surname in 1 query / statement .. and i dont want multiple lines .. like.. lets say .. username : maria33 forname : maria so this should be 1 row .. when i search mar% and not 2 ! ...

Setting up multiple mysql databases

I have a Mysql/ PHP application. I want to sell it SAS. I am thinking of a hosting company that has multiple databases available. I want a page were they login and I take them to their database. I will have many databases with identical structure. I need a way to switch them into that folder( I may modify some code for them like css) and...

select with likewise data

I have a table in database that is having some fields one of which is 'action' action is having data like bse-similar,bse-action.....nse-similar,nse-action...etc. now i want to fetch the data that is having 'bse' in its action field. How can i do that in mysql????? One more thing i want to copy this data to another table.How can i do...

MySQL: Sum Subqueried Columns

Is there an elegant way to do this in MySQL: SELECT (subquery1) AS s1, (subquery2) AS s2, (s1+s2) AS s3 or must I resort to SELECT (subquery1) AS s1, (subquery2) AS s2, ((subquery1)+(subquery2)) AS s3 ? Thanks EDIT: both subqueries yield integer results ...

Difference between using from list and left join.

I have two database tables with the following structure: actions: action_id int(11) primary key action_name varchar(255) action_module varchar(45) permissions: perm_id int(11) primary key perm_role int(11) perm_action int(11) perm_status int(11) Now I have to check whether there is an entry in the permission...

How to enable users from another domain to search records from my domain?

Hi On my website users can keyword search and find desired results. (Just a simple keyword search, WHERE word LIKE %abc% OR LIKE %cde% etc etc). This all works fine. I have some partner websites which want to put a search box on their website to search records from my website and display on their website. We are using PHP and MYSQL....

MySQL Session Table Approach

Hi all, I am developing a multi-tenant web application using LAMP. All my user session data is currently stored in mysql with table type InnoDB. Is there any way that I can use MEMORY (used to be HEAP) table type to store the current sessions and use the garbage collector function of the session handler to move sessions between the Inn...