I have this query:
SELECT COUNT(articles.id) AS count
FROM articles, xml_documents, streams
WHERE articles.xml_document_id = xml_documents.id
AND xml_documents.stream_id = streams.id
AND articles.published_at BETWEEN '2010-01-01' AND '2010-04-01'
AND streams.brand_id = 7
Which just uses the default equajoin by specifying three tabl...
I have an SQL query that has an alias in the SELECT statement
SELECT
CONCAT(YEAR(r.Date),_utf8'-',_utf8'Q',QUARTER(r.Date)) AS 'QuarterYear'
Later, I want to refer to this in my group by statement.
I'm a little confused...should I wrap this with backticks, single quote or just leave it unwrapped int he group by
GROUP BY
`Quarte...
I have defined a function in my Navigation model that executes a query, and I was wondering if there's a more "Zendy" way of generating/executing the query. The query I'm using was proposed by Bill Karwin on another thread here for setting arbitrary record order. I tried using a prepared statement, but the values in the SIGN() function...
hi i have a table with this elements
id name
1 luke
2 johnny
3 perry
4 jenny
5 mark
I have to do a query that take the first element and the lasts 2
i this example
1 luke
4 jenny
5 mark
how can i do?
thanks
...
I recently upgraded MySQL to 5.1.41. Before the upgrade the following SQL worked (or at least I thought I remembered it working...it has been a few weeks since designing this...). Now the SQL gives me an error stating that the "archived" column is ambiguous. How can I write this differently, or is there a different problem I'm not awa...
Hi. I have to select the last two records for every topic.
ex:
table: msg
id | topic_id
------------
1 | 1
2 | 1
3 | 1
4 | 1
5 | 2
6 | 2
7 | 2
8 | 3
9 | 3
10 | 3
I want to obtain these rows:
3 1
4 1
6 2
7 2
9 3
10 3
How can I do this?
thanks
...
I was wondering how can I validate a single checkbox using PHP and MySQL.
Here is the HTML.
<input type="checkbox" name="privacy_policy" id="privacy_policy" value="yes" />
...
Is this combination possible at all?
If yes, will I still need to buy Visual Studio? Will I be able to use MySQLi via C#?
Thank you.
Update: So, does it mean I can use anything from C# ASP.NET (like controls) and it'll work under Mono?
...
I'm trying to check if the checkbox has been checked and display the check mark for the user to see when they check there account settings. I want to know how can I fix this problem using PHP so that the check mark is displayed every time the user views their account settings?
Here is the HTML.
<input type="checkbox" name="privacy_poli...
I have a large database table in SQLExpress on Windows, with a particular field of interest 'code'.
I have an Apache web server with MySQL on Linux. The web application on the Linux box needs access to the list of all codes. The only thing it will use the list for is checking for the existence of a given code.
Having the Linux server ...
Wordpress ships with the wpdb class which handles CRUD operations. The two methods of this class that I'm interested in are the insert() (the C in CRUD) and update() (the U in CRUD).
A problem arises when I want to insert a NULL into a mysql database column - the wpdb class escapes PHP null variables to empty strings. How can I tell Wor...
I have a system I am trying to design that will retrieve information from a database, so that it can be plotted in a jquery graph. I need to retrieve the information and somehow put it in the necessary coordinates format (for example two coordinates var d = [[1269417600000, 10],[1269504000000, 15]];).
My table that I am selecting from i...
I need to connect to another database in Joomla! that's on another server. This is for a plugin and I need to pull some data from a table.
Now what I don't want is to use this database to run Joomla!, I already have Joomla! installed and running on its own database on its server but I want to connect to another database (ON TOP of the c...
Hey everyone,
I'm wondering how I can hook up an input type=file to send a picture back to a backend servlet that will eventually be stored in a MySQL database as a BLOB? In other words, how can I upload a picture using the input and send that back to the servlet to insert into the database as a BLOB type?
Thanks
...
Say you have a MySQL 5.0 MyISAM table with 100 million rows, with one index (other than primary key) on two integer columns.
From my admittedly poor understanding of B-tree structure, I believe that a lower cardinality means the storage efficiency of the index is better, because there are less parent nodes. Whereas a higher cardinality ...
I am messing around with one of my databases.. is there away for me to search for a string in ALL the tables.. and replace it with another everywhere it occurs?
I am looking for SQL
...
I have a "items" table with 1 million rows and a "users" table with 20,000 rows. When I select from the "items" table I do a join on the "users" table (items.user_id = user.id), so that I can grab the "username" from the users table.
I'm considering adding a username column to the items table and removing the join. Can I expect a decent...
I few days ago I update my macbook pro to snow leopard, and since then some php files are not showing.
This is what happens:
I created a php form, when going to 'http://localhost/webform.php' I can see the form just fine. Then, once I submit the form, I just get a blank page.
I enable error and warnings reporting under php.ini to mak...
I have a large list of phrases / quotes / sentences in a text file. Mixed alphanumeric text, it hasn't been screened for "'s or ''s.
Is there an easy way to throw this into a table?
...
When I try rake db:migrate, I get the following error:
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql
And when I try to "gem install mysql"
Building native extensions. This could take a while...
ERROR: Error in...