Current Code:
WHERE EXTRACT(YEAR_MONTH FROM timestamp_field) = EXTRACT(YEAR_MONTH FROM now())")
Instead of EXTRACT(YEAR_MONTH FROM now()), I want EXTRACT(YEAR FROM now()), but I want to hard code the month in. How do I go about concatenating the extract results with the MM month, for example 09.
I tried a few options below, with no l...
SELECT gameratingstblx245v.gameid,avg( gameratingstblx245v.rating ) as avgrating, count(gameratingstblx245v.rating) as count,gamedata.name ,gamedata.gameinfo
FROM gameratingstblx245v
LEFT JOIN gamedata ON gamedata.id = gameratingstblx245v.game_id
WHERE gameratingstblx245v.game_id=gameratingstblx245v.game_id
GROUP BY gameid
ORDER BY a...
My MySQL database has a date field in the format:
yyyy-mm-dd
but in ASP .NET this shows as:
9/14/2009 12:00:00 AM
in both the ItemTemplate and EditItemTemplate.
How do I format the field to display properly?
...
I have database schema of order_lines as
product_id, quantity, created_at
I want to query result like
date 1 2 3 4 5 ..
product 1 count 2 ...
product 2 count 5 ...
Is it possible to do this in mySQL ?
...
In MySql, if the first argument of an IF() function is a string, why does it return false?
SELECT IF('string', 'string', 'not string'); -- 'not string'
Of course I could sort of fix this if I did
IF(!ISNULL('string'), 'string', 'not string')) -- 'string'
or
IFNULL('string', 'not string'); -- 'string'
It seems somewhat counter-i...
I am changing from MySQL to PostgreSQL but can't find equivalent to MySQL's collation utf8_general_ci. What I'm trying to achieve here is to be able to compare strings using general language rules rather then binary comparison, i.e. í = i, š = s, ḩ = h, etc...
Is there a way how to make PostgreSQL search for strings using general langua...
Tables
file_logs
file_id
user_id
files
id
name
etc ...
published_ratings
author_id
file_id
comment
etc ...
Scenario
I am creating a download log and need to display which files a user has rated as well as the unrated ones, this has to be done with 1 query.
I already took a crack at this,
SELECT
files.*,
IF(file_...
I'm trying to evaluate Ruport for use in my Rails app, but am not sure how to take a series of records with date/time stamps and group them via Ruport's grouping functions.
I'm open to other/better methods to do this same grouping if Ruport doesn't make sense.
...
I have three tables, the first two fairly standard:
1) PRODUCTS table:
pid
pname, etc
2) CART table:
cart_id
cart_pid
cart_orderid etc
The third is designed to let people save products they buy and keep notes on them.
3) MYPRODUCTS table:
myprod_id
myprod_pid
PRODUCTS.prod_id = CART.cart_prodid = MYPRODUCTS.myprod_pid
Whe...
I have a VB.NET application that has been accessing MySQL stored procedures using .NET Connector 5.0.7. We recently upgraded to .NET Connector 5.2.6 and I now receive the following error:
"Procedure or function 'proc_scheduleProcess' cannot be found in database 'ProjectMgr'."
The following code has been running without issue until the...
Hi all,
I have a problem with the MySQL root user in My MySQL setup, and I just can't for the life of me work out how to fix it. It seems that I have somehow messed up the root user, and my access to databases is now very erratic.
For reference, I'm using MAMP on OS X to provide the MySQL server. I'm not sure how much that matters thou...
I am evaluating the prospect of developing a commercial java web application using Hibernate as the ORM framework. This application would be installed on a customer's server and would be used by a small number of users. Also I do not want to release my source code since the application is mission critical and it would potentially jeopa...
Hi all,
I'm trying to create a simple search page, but I'm not 100% sure how to write the actual search string (using the appropriate AND's etc if the variable exists) here's the code:
if ($post) {
//get all search variables
$type = JRequest::getVar('type');
$classifications = JRequest::getVar('classifications', array(0), ...
I'm pretty new to MySQL, and I hope i'm getting things right.
I've set up a database with 3 tables with columns as below (Primary keys are PK):
Users table
uid (PK)
username
Directories table
uid
path
project
DirInfo table
infoID (PK)
size
dateofcheck
exists
pathID
When I insert NULL values to Directories.pathID, I get a new...
I don't know MySQL has autoscaling property when we use Amazon EC2.
...
I have 2 tables tbl1 and tbl2
tbl1 has userid col1 col2 col3 (multiple records per user)
EDIT tbl2 has userid col4 col5 col6 (Single record per user)
On my original post I had col3 listed here as well which was accident.
tbl2 is used to store custom column names for each user.
now I need to know how do I display this custom column n...
Currently, I am using an with ajax to update my mysql. Now, I have to click on the button with the mouse for it to work (I am using onclick), but how can I make it accept the "enter" button? My guess is... Enter isn't working because isn't there. If I leave it there, my ajax just doesn't move.
...
This should be a simple question, but I can't get it to work :(
How to select rows that have the maximum column value,as group by another column?
For example,
I have the following table definition:
ID
Del_Index
docgroupviewid
The issue now is that I want to group by results by docgroupviewid first, and then choose one row from eac...
I have a pre-existing mysql database containing around 50 tables.
Rather than hand code a declarative style SqlAlchemy class (as shown here) for each table, is there a tool/script/command I can run against the mysql database that will generate a python class in the declarative style for each table in the database?
To take just one tabl...
My site is going to have many products available, but they'll be categorised into completely different sites (domains).
My question is, am I better off lumping all products into one database and using an ID to distinguish between the sites, or should I set up a table and /or DB per site?
Here are my thoughts
SEPARATE DATABASES
Easie...