473,383 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

updating old query?

I am migrating bugzilla from mysql 3 to mysql 5. I cannot upgrade
bugzilla itself yet, I must migrate it first. One (probably several)
of the queries is of the form 'select ... from ... left join ... on'.
The problem seems to be table aliasing between the left join ... and
the on (LEFT JOIN profiles map_qa_contact ON). Is there an updated
syntax I can use to massage the query and get this part working?

Mike

actual query:

SELECT bugs.bug_id, bugs.groupset, substring(bugs.bug_severity, 1, 3),
substring(bugs.priority, 1, 3), substring(bugs.rep_platform, 1, 3),
map_assigned_to.login_name, substring(bugs.bug_status,1,4),
substring(bugs.resolution,1,4), substring(bugs.short_desc, 1, 60)
FROM bugs, profiles map_assigned_to, profiles map_reporter LEFT JOIN
profiles map_qa_contact ON bugs.qa_contact = map_qa_contact.userid
WHERE bugs.assigned_to = map_assigned_to.userid AND bugs.reporter
= map_reporter.userid AND bugs.groupset & 0 = bugs.groupset GROUP
BY bugs.bug_id;
Aug 16 '06 #1
2 2777
On 2006-08-16, Mike <mi***@mikee.ath.cxwrote:
I am migrating bugzilla from mysql 3 to mysql 5. I cannot upgrade
bugzilla itself yet, I must migrate it first. One (probably several)
of the queries is of the form 'select ... from ... left join ... on'.
The problem seems to be table aliasing between the left join ... and
the on (LEFT JOIN profiles map_qa_contact ON). Is there an updated
syntax I can use to massage the query and get this part working?

Mike

actual query:

SELECT bugs.bug_id, bugs.groupset, substring(bugs.bug_severity, 1, 3),
substring(bugs.priority, 1, 3), substring(bugs.rep_platform, 1, 3),
map_assigned_to.login_name, substring(bugs.bug_status,1,4),
substring(bugs.resolution,1,4), substring(bugs.short_desc, 1, 60)
FROM bugs, profiles map_assigned_to, profiles map_reporter LEFT JOIN
profiles map_qa_contact ON bugs.qa_contact = map_qa_contact.userid
WHERE bugs.assigned_to = map_assigned_to.userid AND bugs.reporter
= map_reporter.userid AND bugs.groupset & 0 = bugs.groupset GROUP
BY bugs.bug_id;
Reading something else I modified the perl script to put everything
between FROM and LEFT JOIN in parenthesis. The code (at work) looks
something like this:

if($query =~ /^(.*\s+FROM)\s+(.*)\s+(LEFT JOIN\s+.*)\s*$/oi) {
$query = $1 . ' ( ' . $2 . ' ) ' $3;
}

This seems to work for now. I'll try to upgrade bugzilla soon.

Mike
Aug 16 '06 #2
Mike wrote:
FROM bugs, profiles map_assigned_to, profiles map_reporter LEFT JOIN
profiles map_qa_contact ON
The problem is actually the way they mix SQL89 "comma-style" joins and
SQL92 "JOIN" syntax.

See http://dev.mysql.com/doc/refman/5.0/en/join.html, under the heading
"Join Processing Changes in MySQL 5.0.12".

The solution is to rewrite comma-style joins into SQL92 syntax:

FROM a, b LEFT JOIN c ON <expr>
WHERE a.x = b.y

Can be rewritten as:

FROM a
JOIN b ON a.x = b.y
LEFT JOIN c ON <expr>

As you might expect, the most recent release of Bugzilla has already
fixed all such cases. I read it in the bug logs of the Bugzilla
product, some time back when someone had the same issue that you are
having now.

Regards,
Bill K.
Aug 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
0
by: Bob Kaku | last post by:
I'm trying to create a text editing and updating capability to help someone who wants to maintain content on a web page without having to know any HTML or use a web authoring tool and FTP'ng the...
6
by: Hennie de Nooijer | last post by:
Hi, Currently we're a building a metadatadriven datawarehouse in SQL Server 2000. We're investigating the possibility of the updating tables with enormeous number of updates and insert and the...
1
by: Derek Davlut | last post by:
I have a Table that contains data that I use in a query to manipulte the data through expressions. I have a form that uses the query for manipulating the data. How do I write the changed values...
1
by: Chris Jackson | last post by:
I'm a novice Access user and am not sure how to solve the following problem. Any help with the following would be greatly appreciated! I have two tables with identical structures, the first holds...
2
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the...
3
by: MLH | last post by:
I have a form, bound to a query. Its RecordSource property is a query named frmEnterLienAmounts. The form has a few bound controls and some unbound controls. The unbound controls are calculated...
0
by: Michael Kellogg | last post by:
I have a problem wherein a query that updates a GridView doesn't seem to really stay in sync with a label I have above the GridView. I have a GridView object that I'm updating with information...
0
by: teammcs | last post by:
Hey all, I'm new around here but do Admin over @ PHPHelp.com... I've been developing a project for my degree which is basically based around an ATM machine. Basically my problem is related to...
6
by: OldBirdman | last post by:
I don't really know how to state this problem, as it doesn't make any sense to me. I have a simple "One-to-Many" query, and was updating the Many side. It quit working. I cannot make any changes...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.