mysql

How should I setup my database to allow for followers/following like Twitter?

I have groups on my website, and would like users to follow groups, and groups to follow users. I was wondering how does the following/follower works, in terms setting out in a MySQL table and referencing users? I'm very confused!! ...

mysql select - subquery, group_concat() not working / too slow...

Hi, I'm having trouble working out a query. I've tried subqueries, different joins and group_concat() but they either don't work or are painfully slow. This may be a bit complicated to explain, but here's the problem: I have a table "item" (with about 2000 products). I have a table "tag" (which contains about 2000 different product tags...

tomcat 6.0 with JDBC throws ClassNotFoundException com.mysql.jdbc.Connection

I've successfully connected to MySQL database through Eclipse without getting tomcat involved, so at lease it's some good progress. But when I try from my web page (Tomcat 6.0), it throws an error. I followed the tutorials, read documentations and looked countless forums but cannot figure out for 2 days now. Let's look at the step one b...

move one row to the end of a result set in MySQL

Hi, I would like to move a row to the bottom of the result set given a matched condition. Database +-------+------------+ |Symbol | Percentage | |-------|------------| |VG | 20 | |-------|------------| |CASH | 20 | |-------|------------| |GOOG | 60 | +-------+------------+ ex: SELECT * FROM TableName ...

How do I do 2 unique LEFT JOINs on the same table cell?

Hi, In mysql I'd like to do 2 unique LEFT JOINs on the same table cell. I have two tables. One table lists individual clients and has a clientNoteID and staffNoteID entry for each client. clientNoteID and staffNoteID are both integer references of a unique noteID for the note store in the notesTable. clientsTable: clientID | client...

how to account for a newline in a mysql text field?

what's the proper syntax to account for a newline in "text" field? for example, mysql_query("select * from table where misc_note='hello\nworld'") isn't working ...

Getting extra data from the join table

Ok so i have this structure PRODUCTS * PRODUCT_ID (primary key) * PRODUCT_NAME CATEGORIES * CATEGORY_ID (primary key) * CATEGORY_NAME * CODE PRODUCT_CATEGORIES_MAP * PRODUCT_ID (primary key, foreign key to PRODUCTS) * CATEGORY_ID (primary key, foreign key to CATEGORIES) * QUANTITY I am using this query SELECT * FROM `products...

Change attribute ordering in Magento's advanced search page

I have a few custom attributes on my products in Magento and they are searchable in Magento's search page; problem is that the fields are listed in the wrong order on the search page; For example: Title _____ Author _____ SKU _____ ISBN _____ Should be: Author _____ Title _____ ISBN _____ SKU _____ I've taken a loo...

MySQL Auto Increment Based on Foreign Key

Lets say I have the following table called assets with the following fields: id | job_id | title I would like to use id and job_id as the primary keys. job_id is the foreign key. The id field is auto incremented. How would I get id to start incrementing at 0 if there is no row with the same job_id. If there is a row with the same job_...

mysql error on trigger creation with extract function

When I try create a trigger as given below, CREATE TRIGGER FiscalYearTable1_bi BEFORE INSERT ON FiscalYearTable1 FOR EACH ROW IF ( ( EXTRACT (YEAR FROM FiscalYearTable1.start_date) != FiscalYearTable1.fiscal_year - 1) OR (EXTRACT (MONTH FROM FiscalYearTable1.start_date) != 04) OR (EXTRAC...

MySQL - Mapping user username to user's ID in a query

I've done some complex SQL queries, but never joined two tables by multiple values, and im not sure is it is possible. I've the following two tables: users +-------+----------+ | u_ID | username | +-------+----------+ | 1 | Pablo | +-------+----------+ | 2 | Mike |...

How to do this MySQL Query in Core Data?

How would I do the equivalent of this statement in Core Data? Basically I want to get a list of the 10 most occurrences of foo along w/ how many times it occurs. Basically I'm recording all of my users searches as individual entries in Core Data. I want to be able to select their 10 most searched items and display them in order starting...

MySQL: Materialized Views?

Possible Duplicate: Is it possible to have an indexed view in MySQL? Does MySQL support Materialized Views (for crazy fast SELECT performance)? If so, how do I create one? ...

How should i deal with the card assigment of my game ?

I've checked most of the question that was display regarding my title but they were not related to what i am looking for, so i am starting my own question. The game i am trying to re-create as an online game is called Buraco not sure if most or any of you know of it. I already have the basic functions of my game such as: shuffle the ...

PHP and MYSQL : do while that dosn't work

Hello, I would like to display Division, then categories under each division and subcategories who's under each catagory. But when I do my do while I didn't receive the right result... example of what I want: Division Name Categorie Sub-categorie Sub-categorie Sub-categorie Categorie 2 Sub-categorie 2 Sub-categorie 2 Sub-...

Prepping comma delimited string for mysql's WHERE IN

I have the following string... 1,2,3,4,5,6 I want to have this like '1','2','3','4','5','6' To use in MySQL's WHERE IN () Would anyone know the best way to do this? Thanks! ...

PHP MySql and geolocation

I am writing a site that basically looks for places within a 25 mile radius of a lat and long using php and mysql. I am wondering how something like this would work? I would pass a lat and long to the scrip and have it pull out only locations that are within 25 miles of the lat and long from my Database of locations. What is the best ...

how to enable ffmpeg enable in server

The server seems to not support ffmpeg format while I asked the support team but I am confused why this happens with the server as the ffmpeg is widely used for processing videos & audio format files in the server side. Is there any way do something from my part to make this working. ...

show and mark some records on top

My target DBMS's are both Oracle and MySQL SELECT users.* , hr_orders.position_label , hr_orders.is_boss , deps.label AS dep_label -- preprocessor removes AS when using Orcale , users.id IN (?) AS show_on_top -- Orcale doesn't accept this IN thing FROM -- some joins here WHERE -- some filters Is it possible to ...

How to maintain chat data ?

Hi, I have a curious question... I wanted to know how to maintain chat data in a database. I have been using a php-mysql application, that stores chat data of users in a database. Now my question is that, if the chat data increases, say, to some millions of records, how to store it? Does mysql support it, or have any limitations ? Take...