I'm having a difficult time, based on the documentation, of figuring out how to equate week numbers between Perl and MySQL.
How would I calculate the same exact week number in both Perl and MySQL based on a unix timestamp in the same time zone?
SELECT DATE_FORMAT(from_unixtime(datefield), '%Y%U') FROM table;
and
print strftime('%Y%U...
Hello,
I am working on a simple search script that looks through two columns of a specific table. Essentially I'm looking for a match between either a company's number or their name. I'm using the LIKE statement in SQL because I am using InnoDB tables (which means no fulltext searches).
The problem is that I am working in a bilingual e...
SELECT p.id
FROM produkty p, przyporzadkowania pr, stany_magazynowe, gk_grupy_produkty
INNER JOIN sub_subkategorie ssi
ON pr.sub_subkategorie_id = ssi.ID
Tables and their important fields
produkty - id, pozycja
przyporzadkowania - id, produkt_id, sub_kategoria_id, sub_subkategoria_id
sub_subkategorie - id, subkategorie_id, pozycja
sub...
Hello all.
Never came across this before...
SELECT ".TBL_USERS.".username,
".TBL_USERS.".id, <-----------|
".TBL_COMMENTS.".creator, |
".TBL_COMMENTS.".comment, |- same column name
".TBL_COMMENTS.".date, |
".TBL_COMMENTS.".id <---------|
As you can see, I am selecting two id colu...
I have this simple query:
SELECT High, Low FROM prices
WHERE Stock = 'XXX' and Date = '2010-02-05' and Low <= 14.88 AND High >= 14.88
Now for 2010-02-05 Low=14.88 and High=15.88
How come the query return empty?
It's running on MySQL 5.0.41
Thanks!
...
I have a categories table set up as so [id, name, parent_id] and a items table [id, name, category_id, visible]. What I'm trying to do is create a query that will return all the ids of all non-empty categories, non empty being that it or one of it's children has at least one item belonging to it. What would be the best way to do this in ...
I'm trying to count the number of rows in a table and thought that this was the correct way to do that:
$result = $db->query("SELECT COUNT(*) FROM `table`;");
$count = $result->num_rows;
But counts always returns (int)1. If I use the same query in phpMyAdmin I get the right result. It sits in a table so I tried testing $count[0] as we...
Hi,
In a mysql table for a date column(login_time), i need to get the logins for
last 30 days, last 60 days.
Is there any way to do that?
Thanks.
...
I am getting the error "cannot issue data".
Here is the SSCCE
//package mysqltest;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.Applet;
import java.awt.TextArea.*;
import java.sql.*;
import java.util.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import java.net.*;
import java.ap...
I have an old PHP application with a bunch of MySQL tables. I want to rewrite it with Rails(3) and want to import the old data. How can I write a migration-script to import the MySQL-Dump into a sqlite DB?
...
Hi,
I am looking to create a calendar based on some pre-existing event entries. I currently have a event creation system using MySQL and PHP. However, I can only list these in an agenda format, sorted by soonest event.
Is there some existing method of creating a monthly calendar based on events in a database? I have little coding expe...
I'm trying to use Spring DAO with Hibernate for a web application. When I try to persist information in the DAO using
getHibernateTemplate().save("bar", bar);
I get the following in Tomcat:
org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert:
[com.enw.foo.domain.Bar]; nested exception is org.hibernate...
Having trouble setting the value of a declared variable in MySQL. If I run the following in MySQL Command Line it all works great:
SET @numberOfMonths = (SELECT COUNT(\*) FROM (SELECT DISTINCT months WHERE year = 2010) as A);
SELECT @numberOfMonths;
So it returns 6 for this particular example.
If I do the following I don't have ...
I am getting this error:
FOR REAL Looking for database...
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstan...
I'm getting a syntax error on the following query:
SELECT 1,2 WHERE 1=1
But this query works fine:
SELECT 1,2 FROM (SELECT 1) t WHERE 1=1;
It almost looks like a WHERE clause always needs a table. Sometimes, in the depth of a complex query it's nice to use a SELECT/WHERE combo to turn on and off certain features. Is there a way...
I'm on an optimization kick, at the moment.
I tend to use multiple tables, so I don't have empty columns.
My question is, are empty columns a big deal? I'm not talking for space. I'm referring to speed of indexing, data retrieval, etc...
My bet example is when I have a simple customers table, and some columns are not always filled. ...
Here is my current code. I'm trying to display data from three separate queries into a single table with multiple columns. Is my while statement wrong here? It's printing 1 table data, then the one after, instead of next to it in the same row.
echo "<table border='1'>
<tr>
<TH COLSPAN=2>July 2010</TH>
<TH COLSPAN=2>August 2010</TH>
<TH ...
I think this is a long-shot, but here it goes:
The basic question is: how does a development team beginning to repair data integrity on a large, damaged dataset?
The company I'm helping out has a huge MySQL/PHP5 sytem with a few years of cruft, invalid data, broken references, etc. To top it all off, this data references data on a few ...
What query would I have to use to check if the querying user has permissions to create temporary tables in the database?
...
Hello.
I'm somehow in a MySQL session but I don't know what server I am connected to, etc. Is there a MySQL command that will tell me the host, port, and username I am using now?
Thanks!
...