I am considering switching from Firebird where I'm using a hand-built replication to MySQL and its integrated replication solution. I have 4 departments with sporadic network connections. Each one has to have its copy of the database, and has to be able to update database, so I decided that using ring replication method (A->B, B->C, C->D...
The title is a bit wonky but it's the best I could come up with at 4 in the morn'. I have a table of links that I am paginating, nothing fancy. Let's say there are 100 links that are displayed 20 a page for 5 pages. How can I number each link starting with 1 and ending with 20 on the first page and if we skipped to the last page would...
I want to create a view from the following two tables:
Entry:
entry_id
entry_date
entry_amount
user_id
Forecast:
forecast_id
forecast_date
forecast_amount
user_id
Now I want to have a view which combines each entry with its forecast (same user_id and same date). This is fine, but I have a problem with those rows, which have a forecas...
I have a table holding values for each month of different years.
Entries:
entry_id
entry_date
entry_amount
Now I want a view which holds all entry values, and the cumulative sum of the current year's amounts.
Entries_sum_view:
entry_id
entry_date
entry_amount
entry_cumulative_yearly_sum
where entry_cumulative_yearly_sum = SUM(all e...
I've tried the below script but I am getting an error:
dim cn, rs
set cn = CreateObject("ADODB.Connection")
set rs = CreateObject("ADODB.Recordset")
cn.connectionstring = "Provider=MysqlProv; Data Source=Adonis; User Id=mysqluser; Password = mysqlpass;"
cn.open
rs.open "select * from Countries", cn, 3
rs.MoveFirst
while not rs.eof
...
Hello,
Im getting an error with a rails app.
The bundled mysql.rb driver has been
removed from Rails 2.2. Please install
the mysql gem and try again: gem
install mysql.
And when i try to do gem install mysql it still doesnt work and im getting this error.
WARNING: Installing to ~/.gem since
/Library/Ruby/Gems/1.8 and ...
I have some blog titles that are in uppercase and id like to change them to title case? Is there a way to do this using SQL?
Thanks
...
I successfully installed MySql x86_64 in Snow Leopard and Ruby and Ruby Gems seems to be installed properly:
$ which mysql
/usr/local/mysql/bin/mysql
$ which ruby
/usr/bin/ruby
$ which gem
/usr/bin/gem
$ mysql
Your MySQL connection id is 404
Server version: 5.1.37 MySQL Community Server (GPL)
$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel ...
HI I want to how a gui for building my queries. It would be nice for it to have syntax validation. Ie if I have a missing quote it'll tell me. It balances brackets. It's simple but very easy to get wrong.
...
Hi i want to browse every 10 records on a click. The AJAX call should fetch next 10 records each from SQL QUERY when clicked on next or previous. At the initial page i have a SQL QUERY which fetches 10 records
SELECT VENUENAME FROM VENUES LIMIT 10
<a style="float:right" id="next-nav" href="#">Next</a>
$("#next-nav").click(function(){...
Consider the following code snippet:
$beat = date('B'); // 1 beat = 86.4 seconds, 1000 beats = 1 day
$total = 'SELECT COUNT(id) FROM ads WHERE featured = 1;'; // number of featured ads
$current = 'SELECT * FROM ads WHERE featured = 1 ORDER BY id ASC LIMIT 1 OFFSET ' . ($beat % $total) . ';'; // current featured ad
Basically this cycl...
Is there any workaround so I can actually do something like this without having to repeat the entire expression or force a UNION or temporary table?
SELECT (complex expression) AS variable1,
(complex expression based on variable1) AS variable2
Since variable1 is not defined and available to the 2nd item because of how mysql w...
I have multiple tables with Customer data (ex Customer Name, Customer Contact Name, Customer Service Item etc).
I need to enable search on these multiple columns across tables. Then I have to use the search result to pull Customer information (I need Customer ID, or Customer Name).
What is the best way to do this?
Possible Solution...
Hi,
I have two tables and want to left join them.
I want all entries from the account table, but only rows matching a criteria from the right table. If no criteria is matching, I only want the account.
The following does not work as expected:
SELECT * FROM Account a
LEFT JOIN
Entries ef ON ef.account_id = a.account_id AND
(ef.entry_...
Ok I need to build a query based on some user input to filter the results.
The query basically goes something like this:
SELECT * FROM my_table ORDER BY ordering_fld;
There are four text boxes in which users can choose to filter the data, meaning I'd have to dynamically build a "WHERE" clause into it for the first filter used and the...
I have 2 tables, a "document" table and a "content" table. They look like this (simplified):
document table:
docID
docTitle
content table:
contentID
docID
dateAdded
content
For every content change, a new record is inserted into the "content" table. This way there is a complete history of all changes. I would like to get a list of al...
I have a fairly complex community site (in php/mysql) with a number of "things" that the registered users can "watch".
"Things" are: Posts, comments, event updates, user status changes, etc. At least 10 different types of "things" are available and a user can watch any other user's "things" (Think facebook)
"Watch" means: A user can w...
I tried different approaches but even though I think my syntax is ok the query doesn't work.
I have a fairly complicated polls system. In general every answer to poll is putted into one table
CREATE TABLE `polls` (
`poll_id` int(10) NOT NULL auto_increment,
`client_id` int(10) NOT NULL,
`key` varchar(20) NOT NULL,
`val` varchar...
I'm trying to wrap my head around the proper design to calculate an average for multiple items, in my case beers. Users of the website can review various beers and all beers are given a rating (avg of all reviews for that beer) based on those reviews. Each beer review has 5 criteria that it's rated on, and those criteria are weighted a...
Hello All..
My setup: Ubuntu LAMP, application built w/ zend framework
My Problem: I have a few php scripts that I trigger via cron - daily email reports, rrd data capture etc.. I launch them via a cronjob like 'php -f scriptname.php'.
When I test the scripts from the commandline, logged in as myself, everything works fine. However, wh...