Dear Stackoverflow users and contributers,
I have a problem extracting the year out of a mysql timestamp field. I managed to get it work with a datetime field using this method:
SELECT id FROM TABLE WHERE YEAR(creation_date) = 2010
CREATE TABLE IF NOT EXISTS `pub_media` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) D...
I'm using JDBC to access a MySQL 4.1 database and have problems with queries of Decimal type. When I do a query on a single Decimal column (i.e., SELECT amount AS v FROM Customer) I get a BigDecimal through the JDBC driver, but when I do an an operation of Decimal columns (i.e., SELECT amount + tax AS v FROM Customer) I get a Double eve...
Hello. I'm doing this query to get rows that are in table_b and not in table_a:
SELECT table_b.* FROM table_b
LEFT JOIN table_a ON table_b.id = table_a.id
WHERE table_a.item_id IS NULL
This works ok but I need another condition to apply on table_a. I need to compare only the rows that got column X equal with the ID of 3, not to compar...
I'm developing a CMS, and implementing versioning by adding a new entry to the database with the current timestamp.
My table is set up as follows:
id | page | section | timestamp | content
"Page" is the page being accessed, which is either the path to the page ($page_name below), or '/' (to indicate 'global' fields).
"Section" is t...
Is using SELECT Max(ID) FROM table safer than using SELECT last_insert_id(), where they run as 2 separate queries?
I'm concerned that before the last_insert_id() can run, another insert will take place.
...
I am looking to export an exist MySQL database table to seed a Mongo Database.
I would have thought this was a well trodden path, but it would appear not, as i am coming up blank with a simple MySQLDUMP -> MongoDB JSon convertor.
It won't take much effort to code up such a conversion utility.
...
Hello, for example i have this url: http://localhost/miSite/uploads/ and by doing:
http://localhost/miSite/uploads/../includes/, this results in a directory (includes) linsting.
It'd be great if you could tell me a way to resolve this.
...
What are peoples' thoughts on the most performance efficient way to do the following query:
3 column table
if the combination of col_1 and col_2 values already exist UPDATE col_3
else INSERT new row
I assume i need some kind if UPDATE ON DUPLICATE KEY (which i've never used before), however I do not have a 'KEY' but instead a pair o...
I have 2 tables, one called "products" and one "images".
The table "images" hold the images of each products, so I can have 5 image per product.
I want to make a select that retrive only 1 image for each product. I'm new to joins so i dont know how to solve this.
I'm trying with:
SELECT *
FROM products
INNER JOIN images ON ...
I have a common problem to be sure. I'd like to make a query that finds an entity that has "n" tags. So in the simplest case, we find all the entities that have the tag "hey". In a more complex case, we find all the entities that have all the tags "hey", "hi" and "howdy".
It seems that I have to join to the tag table 3 times, and and th...
I have this three tables:
products TABLE:
id:integer
name:string
features TABLE:
id:integer
name:string
features_products TABLE:
product_id:integer
feature_id:integer
The features_products TABLE tells me which features have each product. For example:
product_id feature_id
1 3
1 5
3 4
tells me the ...
So a search on google didn't turn up anything and neither did StackOverflow so far.
Essentially my problem is this: I have a merge table and another normal table I wish to merge into it. Unfortunately one index in this new table is out of position so the merge doesn't work.
Existing merge table indexes:
KEY `Row ID` (`Row ID`),
KEY `C...
Hi, i have a MySQL DB where the rows have characters like %20, %2C, etc...
how can i remove them from the DB without editing the file on notepad?
The .sql file is about 300mb in size...
thanks
...
I'm attempting to figure out how to model a normalized database where a player may have multiple classes. What is the relationship between the player and the class objects?
Each player will be able to have multiple classes and each class will then grant a player multiple skills as well. I'm familiar with normalized database and workin...
I have a project in which I'm accessing a MySql database on my web server via MySql ODBC driver 3.51. So far I've stuck to writing the ASP.NET C# code for this web app in notepad and just using runtime compiles on the server side to operate everything. So instead of using something like:
<%@ Page Title="Add Order" Language="C#" MasterPa...
I have a user table (User) and 3 tutorial tables (Text, Video and Other).
Each tutorial has the columns rating_positive and rating_negative
and is linked to a user (id).
I want to select the 10 users with the most tutorials and the sum
of positive/negative ratings of their tutorials.
I tried the following query but it does not work. I...
$sql=mysql_query("INSERT INTO admin_cont
(contact_idemail , contact_timestamp , contact_objet , contact_message)
VALUES
('".$_COOKIE['zzzzz']."', '$timestamp', '$objet', '$message' ") or die(mysql_error());
i keep getting the error:
You have an error in your SQL syntax; check th...
I am trying to use CONCAT with SQL to concatenate 3 fields, and get the following error:
Incorrect parameters in the call to native function 'CONCAT'
The query is as follows
SELECT CONCAT(guests.lastname,', ',guests.firstname', ',guests.passport) AS display
FROM guests
WHERE guests.uuid = '1'
How do you concatenate more than 2 ...
I am creating a website that will have articles; each article will have comments. These comments will be stored in a "comment" table with a field called "parent_id" that is a foreign key to the field "id" in the same table.
I am hoping to use Hibernate to recursively grab all of the comments for a specific article.
Here is my Entity:...
The same programs work on the Mac but does not seem to work on Windows.
I have tried using both hibernate and a regular mysql.connection but both seem to hang.
My firewalls are all off and I have no problem connecting to the database through 3rd party programs like sqlyog or even through the HQL query generator in netbeans. But when it ...