MySQL Query Help
Is there an easy way to find all records where an ID is found
in a list? For example if I have the following:
TABLE:
resource
FIELDS:
resourceID | listOfIDs | title
RECORDS:
1 | 1,7,9 | Item 1
2 | 2,3,7,8 | Item 2
3 | 8,17 | Item 3
4 | 2,7 | Item 4
I want to query the table for all records where listOfIDs
contains 7. This would return 1, 2 and 3. OR I may want to find
where listOfIDs contains 2 AND 8. This would return 2, 3 and 4.
Normally I would use a second table and have each one of the
list items as a record that links to the resourceID but I'm going
to have 6 different "listOfIDs" type columns so I was just trying
to see if there is a better way.
Thanks for any help.
dbldutch wrote:
> Normally I would use a second table and have each one of
the list items as a
> record that links to the resourceID but I'm going to
have 6 different
> "listOfIDs" type columns so I was just trying to see if
there is a better way.
>
The second related table *IS* the better way. This is why
entire
database doctorate thesis are written on data normalization.
Trust
them, six related tables will be much easier then six columns
each
containing a list of numbers.
Why, because a list of numbers is not a list of numbers to a
database,
it is a string. And the only way to search it is inefficient
string
functions. Your where clause is going to have to look
something like this:
WHERE listOfIDs LIKE '7,%' OR listOfIDs LIKE '%,7,%' OR
listOfIDs like '%,7'
And that is just to search for one possible value in the
list, this
complexity progresses exponentially with each additional
number for
which to search.
Similar Messages
-
I'm fairly new to DW and MySQL. I'm trying to develop what I
thought was a simple search and results app., but am apparently
having a program logic issue
I have a form with 2 radio buttons, code below:
<form name="card_search" id="card_search" method="post"
action="card_search_results.asp">
<p>
<label>
<input <%If
(CStr((rsCardCatBaseball.Fields.Item("catID").Value)) = CStr("1"))
Then Response.Write("CHECKED") : Response.Write("")%>
type="radio" name="RadioGroupCardCat" value="1" />
Baseball</label>
<br />
<label>
<input <%If
(CStr((rsCardCatBaseball.Fields.Item("catID").Value)) = CStr("2"))
Then Response.Write("CHECKED") : Response.Write("")%>
type="radio" name="RadioGroupCardCat" value="2" />
Football</label>
<br />
<input name="submit_card_cat" type="submit"
id="submit_card_cat" value="Submit" />
</p>
</form>
When testing using the GET URL param. I see that the var
RadioGroupCardCat=1 (baseball) or RadioGroupCardCat=2 (football)
are getting passed to the card_search_results.asp page. However, I
can't seem to figure out how to capture the RadioGroupCardCat
values (1 or 2) in my SQL queries. I currently have 2 recordset
queries (rsCardCatBaseball and rsCardCatFootball) below.
rsCardCatBaseball:
SELECT tblcard.cardyear, tblcardvend.vendname,
tblcard.cardnum
FROM tblcard, tblcardcat, tblcardvend
WHERE RadioGroupCardCat=1 AND
tblcardvend.vendid=tblcard.vendid AND
tblcardcat.catid=tblcard.catid
rsCardCatFootball:
SELECT tblcard.cardyear, tblcardvend.vendname,
tblcard.cardnum
FROM tblcard, tblcardcat, tblcardvend
WHERE RadioGroupCardCat=2 AND
tblcardvend.vendid=tblcard.vendid AND
tblcardcat.catid=tblcard.catid
'catid' is the MySQL table field with either a value of 1
(baseball) or 2 (football). I'm using ASP/VBScript, so below is how
the variable is declared in the RecordSet variables area of DW.
FOR rsCardCatBaseball:
NAME
RadioGroupCardCat
DEFAULT VALUE
1
RUNTIME VALUE
Request("catid")
For rsCardCatFootball:
NAME
RadioGroupCardCat
DEFAULT VALUE
2
RUNTIME VALUE
Request("catid")
The problem is that I get the same results for both queries.
The results for the rsCardCatFootball query are identicle to the
rsCardCatBaseball query. Aren't I supposed to have 2 seperate
recordsets in the results page so that one gets passed one value
and the other RS gets the other value? Any assistance much
appreciated. Thanks.A radio group is only supposed to pass one value from the
form depending
upon which option has been clicked, therefore on the results
page you should
only need one recordset providing that everything is going
against the same
table. Providing that a value of 1 or 2 relate to the same
field then you
will be able to use the recordset dialogue box to build the
SQL.
However if different tables or fields are involved then you
will need to
handwrite the SQL statement
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"obcbeatle" <[email protected]> wrote in
message
news:[email protected]...
> After reading my original post, I see that it is was not
worded very well.
> Basically the problem I am having is understanding how
to capture values
> that
> are sent from a form to results page using Dreamweaver
MX and MySQL.
> Specifically, creating a group of two radio buttons
where two values are
> sent
> to a results.asp page that contains a Recordset Query
(using MySQL syntax)
> that
> will display the query results based on the values being
sent from the
> form
> with the radio buttons. The radio button values being
sent are either a
> '1' or
> a '2', depending on which radio button is selected and
submitted. My
> current
> understanding is that I need to have two Recordset
queries, one to capture
> each
> value being submitted. Thus I have a Recordset with a
MySQL select
> statement
> designed to capture the value '1' and display the
results, and a Recordset
> with
> a MySQL statement to capture the value '2' and display
the results. At
> present
> when I Submit the radio button values, either a '1' or
'2', I always get
> the
> display results for the Recordset Query designed to
capture the value '1'.
> So,
> I believe that either I have NOT designed the program
logic correctly in
> Dreamweaver to capture two different values using two
Recordsets, or my
> MySQL
> statement is flawed. I guess my primary questions are:
>
> 1) Should I be using two Recordsets or one Recordset in
this case?
>
> 2) If I should be using one Recordset, can anyone point
me to a sample
> MySQL
> select statement that handles two vales being submitted
from a form?
>
> I have googled extensively looking for examples of how
to do this, and
> used a
> book I have that has some examples, but NOT MySQL
examples. Any
> comments/suggestions appreciated. Thank you.
> -
Ok, I've got a table like this:
style color size
145 red s
145 red m
145 red l
145 blue s
145 blue m
150 red s
150 red m
etc etc....there is also a sku field as primary key for each item.
I'm sure it's simple, but how the heck can I get a list of style and color without the size?
Like:
style color
145 red
145 blue
150 red
Thanks,
Scott
Edit: answer: select distinct color,style from table;
I thought at first that would only give me the distinct colors for the whole table, not for each style. Ah well
Last edited by firecat53 (2010-02-02 18:06:14)You can try
select style, color from tablename
where tablename is the name of the table where is your data.
Last edited by noreaga (2010-02-02 18:05:07) -
Help with mysql query plz anyone i am begging!!!
Hi everyone pls forgive me i am new to java. can someone pls tel me where i am going wrong wit this mysql query?
<sql:query var="parish" maxRows="1" dataSource="jdbc/gav">
SELECT ParishName, OwnerOccupierHousehold, OwnerOccupierPercOfOverall, OwnerOccupierCo2Emissions,
SocialRentedHousehold, SocialRentedPercOfOverall, SocialRentedCo2Emissions, PrivateRentedHousehold,
PrivateRentedPercOfOverall, PrivateRentedCo2Emission, TotalHouseholds, TotalPerc, Average,
Total2001, TotalEstimatedTotal2006, EmissionsPerPerson, EmissionPerHousehold, EmissionsPerParish,
EnergyChampionsNeeded, NumberOfPeopleAtWork, NumberOfSchoolAgeChildren
FROM base_data as b
WHERE b.id = ? <sql:param value="${param.id}"/>
<sql:param value="${param.id}"/>
</sql:query>
<c:set var="parish" scope="request" value="${parish.rows[0]}"/>
here is the error i get:
java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
please any help would be appreciated!!! Thanks in advance guys .here is my code for the form on the index page:
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<sql:query var="parish" dataSource="jdbc/gav">
SELECT id, ParishName FROM base_data
</sql:query>
<form action="response.jsp">
Select a Parish: <select name="id">
<c:forEach var="parish" items="${parish.rows}">
<option value="${parish.id}">${parish.ParishName}</option>
</c:forEach>
</select><br><input type="submit" value="submit" name="submit" /></form>
here is the code for the response page:
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<sql:query var="parish" maxRows="1" dataSource="jdbc/gav">
SELECT b.id, b.ParishName, b.OwnerOccupierHousehold, b.OwnerOccupierPercOfOverall, b.OwnerOccupierCo2Emissions,
b.SocialRentedHousehold, b.SocialRentedPercOfOverall, b.SocialRentedCo2Emissions, b.PrivateRentedHousehold,
b.PrivateRentedPercOfOverall, b.PrivateRentedCo2Emission, b.TotalHouseholds, b.TotalPerc, b.Average,
b.Total2001, b.TotalEstimatedTotal2006, b.EmissionsPerPerson, b.EmissionPerHousehold, b.EmissionsPerParish,
b.EnergyChampionsNeeded, b.NumberOfPeopleAtWork, b.NumberOfSchoolAgeChildren
FROM base_data as b
WHERE b.id = ? <sql:param value="${param.id}"/>
</sql:query>
<c:set var="parish" scope="request" value="${parish.rows[0]}"/>
i display the results like this : ${parish.EmissionsPerParish}
the user should be able to select a parish from a form and then sql query created and then i want to show the row results on the response page.
could you tell me where so should be a simple process although not simple enough as it may seem.
thanks for the advice keith -
Need help writing a MySQL query that will return only records with matching counter-parts
Since I don't know how to explain this easily, I'm using the
table below as an example.
I want to create a MySQL query that will return only records
that have matching counter-parts where 'col1' = 'ABC'.
Notice the 'ABC / GHI' record does not have a
counter-matching 'GHI / ABC' record. This record should not be
returned because there is no matching counter-part. With this
table, the 'ABC / GHI' record should be the only one returned in
the query.
How can I create a query that will do this?
id | col1 | col2
1 | ABC | DEF
2 | DEF | ABC
3 | ABC | GHI
4 | DEF | GHI
5 | GHI | DEF
*Please let me know if you have no idea what I'm trying to
explain.AngryCloud wrote:
> Since I don't know how to explain this easily, I'm using
the table below as an
> example.
>
> I want to create a MySQL query that will return only
records that have
> matching counter-parts where 'col1' = 'ABC'.
>
> Notice the 'ABC / GHI' record does not have a
counter-matching 'GHI / ABC'
> record. This record should not be returned because there
is no matching
> counter-part. With this table, the 'ABC / GHI' record
should be the only one
> returned in the query.
>
> How can I create a query that will do this?
>
>
> id | col1 | col2
> --------------------
> 1 | ABC | DEF
> 2 | DEF | ABC
> 3 | ABC | GHI
> 4 | DEF | GHI
> 5 | GHI | DEF
>
>
> *Please let me know if you have no idea what I'm trying
to explain.
>
Please be more clear. You say that 'ABC / GHI' should not be
returned,
and then you say that 'ABC / GHI' should be the only one
returned. Can't
have both... -
Please help -- MySQL Query to Oracle
I have been trying to convert the following MySQL query to work with Oracle 9i. There seem to be two problems:
1) Oracle doesn't like the inclusion of the tblpackagegeneral.packageid in the "ON" clause of the "JOIN".
2) The "GROUP BY" only has the one field, "tblpackagegeneral.packageid", specified; Oracle wants the other two specified as well. When I do that I get a different data set than what MySQL returns for the same tables of data: specifically MySQL returns one row for each packageid but the revised Oracle version returns more than 1 sometimes.
I would appreciate any assistance possible.
/* Formatted on 2003/07/07 14:43 (Formatter Plus v4.8.0) */
SELECT tblpackagegeneral.packageid,
CASE
WHEN NVL
(COUNT (tblpackagelearnerassignment.learnerid),
COUNT (tbllearnergeneral.learnerid)
) > 0
THEN 'Activity'
WHEN tbllearnergeneral.subscribetopubliccourse = 'true'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'ActivityAfterSubscribe'
WHEN ( tbllearnergeneral.subscribetopubliccourse = 'false'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'Subscribe'
ELSE 'Subscribe'
END AS "ASSIGNSTATUS"
FROM tblpackagegeneral, tbllearnergeneral LEFT OUTER JOIN tblpackagelearnerassignment ON ( tblpackagelearnerassignment.packageid =
tblpackagegeneral.packageid
AND tblpackagelearnerassignment.learnerid =
tbllearnergeneral.learnerid
WHERE tbllearnergeneral.learnerid = '%var'
AND tblpackagegeneral.packageavailability = 'Available'
AND TO_CHAR (tblpackagegeneral.dateto, 'YYYYMMDD') >=
TO_CHAR (CURRENT_TIMESTAMP, 'YYYYMMDD')
GROUP BY tblpackagegeneral.packageid;
Sincerely,
Bill RobinsonI have been trying to convert the following MySQL query to work with Oracle 9i. There seem to be two problems:
1) Oracle doesn't like the inclusion of the tblpackagegeneral.packageid in the "ON" clause of the "JOIN".
2) The "GROUP BY" only has the one field, "tblpackagegeneral.packageid", specified; Oracle wants the other two specified as well. When I do that I get a different data set than what MySQL returns for the same tables of data: specifically MySQL returns one row for each packageid but the revised Oracle version returns more than 1 sometimes.
I would appreciate any assistance possible.
/* Formatted on 2003/07/07 14:43 (Formatter Plus v4.8.0) */
SELECT tblpackagegeneral.packageid,
CASE
WHEN NVL
(COUNT (tblpackagelearnerassignment.learnerid),
COUNT (tbllearnergeneral.learnerid)
) > 0
THEN 'Activity'
WHEN tbllearnergeneral.subscribetopubliccourse = 'true'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'ActivityAfterSubscribe'
WHEN ( tbllearnergeneral.subscribetopubliccourse = 'false'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'Subscribe'
ELSE 'Subscribe'
END AS "ASSIGNSTATUS"
FROM tblpackagegeneral, tbllearnergeneral LEFT OUTER JOIN tblpackagelearnerassignment ON ( tblpackagelearnerassignment.packageid =
tblpackagegeneral.packageid
AND tblpackagelearnerassignment.learnerid =
tbllearnergeneral.learnerid
WHERE tbllearnergeneral.learnerid = '%var'
AND tblpackagegeneral.packageavailability = 'Available'
AND TO_CHAR (tblpackagegeneral.dateto, 'YYYYMMDD') >=
TO_CHAR (CURRENT_TIMESTAMP, 'YYYYMMDD')
GROUP BY tblpackagegeneral.packageid;
Sincerely,
Bill Robinson -
Conversion of Mysql query in oracle acceptable query format
Hi
I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
For Example
Select case_id as 'this is alias' from cases
The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
Please help me in resolving this problem
ThanksThe problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all. -
Weird problem with mysql query and data table buttons !!!!
Hi,
I'm using jsc 2 update 1 on windows and mysql 4.1 . I have a page with a data table. One column of the data table contains "Details" buttons.
Source query for the table is :
SELECT tbl_tesserati.idtbl_tesserati idTesserato,
tbl_tesserati.num_tessera,
tbl_tesserati.nome,
tbl_societa.codice_meccanografico
FROM tbl_tesserati
INNER JOIN tbl_rel_tesserato_discipline_societa ON tbl_tesserati.idtbl_tesserati = tbl_rel_tesserato_discipline_societa.id_tesserato
INNER JOIN tbl_cariche ON tbl_rel_tesserato_discipline_societa.id_carica = tbl_cariche.idtbl_cariche
INNER JOIN tbl_qualifiche ON tbl_rel_tesserato_discipline_societa.id_qualifica = tbl_qualifiche.idtbl_qualifiche
INNER JOIN tbl_discipline ON tbl_rel_tesserato_discipline_societa.id_disciplina = tbl_discipline.idtbl_discipline
INNER JOIN tbl_societa ON tbl_rel_tesserato_discipline_societa.id_societa = tbl_societa.idtbl_societa
LEFT JOIN tbl_province ON tbl_societa.provincia_sede_sociale = tbl_province.idtbl_province
LEFT JOIN tbl_comuni ON tbl_societa.comune_sede_sociale = tbl_comuni.idtbl_comuni
LEFT JOIN tbl_rel_tesserato_discipline_praticate ON tbl_rel_tesserato_discipline_praticate.tessera_id=
tbl_rel_tesserato_discipline_societa.idtbl_rel_tesserato_discipline
LEFT JOIN tbl_discipline_praticate ON tbl_discipline_praticate.idtbl_disciplina_praticate=tbl_rel_tesserato_discipline_praticate.disciplina_praticata_id
WHERE
tbl_tesserati.cognome LIKE ?
AND tbl_tesserati.nome LIKE ?
AND tbl_rel_tesserato_discipline_societa.id_societa LIKE ?
AND tbl_tesserati.idtbl_tesserati LIKE ?
AND tbl_cariche.idtbl_cariche LIKE ?
AND tbl_qualifiche.idtbl_qualifiche LIKE ?
AND tbl_tesserati.data_nascita >= ?
AND tbl_tesserati.data_nascita<= ?
AND tbl_discipline.idtbl_discipline LIKE ?
AND codice_affiliazione LIKE ?
AND tbl_societa.denominazione LIKE ?
AND YEAR(tbl_rel_tesserato_discipline_societa.data_scadenza) LIKE ?
AND (tbl_province.nome LIKE ? OR tbl_province.nome IS NULL)
AND ( tbl_comuni.nome LIKE ? OR tbl_comuni.nome IS NULL)
The tbl_tesserati.data_nascita is a mysql date field.
The click event handler code for the "Details" Button is:
public String btnModificaTesserato_action() {
try{
TableRowDataProvider rowData= (TableRowDataProvider)getBean("currentRowTesserati");
getRequestBean1().setId_tesserato((Long)rowData.getValue("idTesserato"));
} catch(Exception ex) {
log("errore nella query",ex);
return "dettaglioTesseratoSocieta";
}When i run the project and open the page the table is correctly rendered and populated with some rows. But when i click on details button nothing happens, the page is simply reloaded.
If i set a breakpoint in the code line TableRowDataProvider rowData= (TableRowDataProvider)getBean("currentRowTesserati");the debbuger does not stop the code execution ! As if the button was never clicked!
I tried to modify the source query to :
SELECT tbl_tesserati.idtbl_tesserati idTesserato,
tbl_tesserati.num_tessera,
tbl_tesserati.nome,
tbl_societa.codice_meccanografico
FROM tbl_tesserati
INNER JOIN tbl_rel_tesserato_discipline_societa ON tbl_tesserati.idtbl_tesserati = tbl_rel_tesserato_discipline_societa.id_tesserato
INNER JOIN tbl_cariche ON tbl_rel_tesserato_discipline_societa.id_carica = tbl_cariche.idtbl_cariche
INNER JOIN tbl_qualifiche ON tbl_rel_tesserato_discipline_societa.id_qualifica = tbl_qualifiche.idtbl_qualifiche
INNER JOIN tbl_discipline ON tbl_rel_tesserato_discipline_societa.id_disciplina = tbl_discipline.idtbl_discipline
INNER JOIN tbl_societa ON tbl_rel_tesserato_discipline_societa.id_societa = tbl_societa.idtbl_societa
LEFT JOIN tbl_province ON tbl_societa.provincia_sede_sociale = tbl_province.idtbl_province
LEFT JOIN tbl_comuni ON tbl_societa.comune_sede_sociale = tbl_comuni.idtbl_comuni
LEFT JOIN tbl_rel_tesserato_discipline_praticate ON tbl_rel_tesserato_discipline_praticate.tessera_id=
tbl_rel_tesserato_discipline_societa.idtbl_rel_tesserato_discipline
LEFT JOIN tbl_discipline_praticate ON tbl_discipline_praticate.idtbl_disciplina_praticate=tbl_rel_tesserato_discipline_praticate.disciplina_praticata_id
WHERE
tbl_tesserati.cognome LIKE ?
AND tbl_tesserati.nome LIKE ?
AND tbl_rel_tesserato_discipline_societa.id_societa LIKE ?
AND tbl_tesserati.idtbl_tesserati LIKE ?
AND tbl_cariche.idtbl_cariche LIKE ?
AND tbl_qualifiche.idtbl_qualifiche LIKE ?
AND tbl_tesserati.data_nascita >= ?
OR tbl_tesserati.data_nascita<= ?
AND tbl_discipline.idtbl_discipline LIKE ?
AND codice_affiliazione LIKE ?
AND tbl_societa.denominazione LIKE ?
AND YEAR(tbl_rel_tesserato_discipline_societa.data_scadenza) LIKE ?
AND (tbl_province.nome LIKE ? OR tbl_province.nome IS NULL)
AND ( tbl_comuni.nome LIKE ? OR tbl_comuni.nome IS NULL)
Using this query everything works well !! The click handler works and the debugger too !!
I changed only the AND in OR !!!
I also tried to change mysql-x-x-connector driver but without solving my problem.
Can someone help me ?
Thanks
GiorgioYou'll find that it is more to do with the way MySql deals with dates than anything else! Depending on how your date field is setup, then try using a BETWEEN statement for those 2 lines in your first query e.g.
AND ( tbl_tesserati.data_nascita BETWEEN ? AND ?)
The date column needs to be in the ISO format to work. If you examine your second query output, you might discover that the output is only going to refer to one parameter (probably the OR one). Did you manage to view the output logs from the application server? You would have got an idea from there with a message like stating a conversion error'.
Alternatively, you could try using the to_days() function and convert it directly to a number which would be a lot easier to deal with. For example:
AND to_days(tbl_tesserati.data_nascita >= ? )
AND to_days( tbl_tesserati.data_nascita<= ? )
Or try the BETWEEN version with to_days() and see what you get.
More info about date formatting (v5) here:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_to-days
Before I forget, sometimes you may need to treat dates as Strings rather 'Long' as you did.
As a matter of interest, did you try your query in a different piece of software?
If my queries are a little more complicated, I tend to try MySql queries out in the free MySql query browser and also double check in another to verify certain issues. I found it easier to develop SQL in a seperate program then import the final version to JSC making the required modifications for parameters.
Message was edited by:
aerostra -
After a rather big upgrade yesterday (see paste below) I have got a problem with MySQL query browser which is found in package mysql-gui-tools. Everything else seems to be okay, but after upgrading mysql-gui-tools from 5.0r12-3 to 5.0r14-1 (..and now, after another update, its at 5.0r14-2) it is no longer able to refresh schema/databases. Every time I try to change/refresh schema in the schema menu to the right the program hangs and I have to kill it. A refresh icon appears as normal to the left of the schema I'm trying to refresh, but that icon too has frozen. I am however able to execute normal SELECT queries etc if I write the full "path" to the table in the SQL query, but when I try a USE query the same thing happens.
I have done some searching on the Internet about this and found this thread to be interesting. Too bad it's from July 2007..
I tried to downgrade to the old version of query browser, but then I got this problem:
/usr/bin/mysql-query-browser-bin: error while loading shared libraries: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
..So I guess theres a dependency problem here with the old version.
Has anyone else got any problem with the MySQL Query Browser after upgrade or has any ideas for a solution?
Log from pacman:
[2009-04-12 13:52] synchronizing package lists
[2009-04-12 13:52] starting full system upgrade
[2009-04-12 13:55] upgraded xf86-input-evdev (2.1.2-1 -> 2.2.1-1)
[2009-04-12 13:55] upgraded xorg-server (1.5.3-5 -> 1.6.0-3)
[2009-04-12 13:56] synchronizing package lists
[2009-04-12 13:56] starting full system upgrade
[2009-04-12 13:56] upgraded glib2 (2.20.0-1 -> 2.20.1-1)
[2009-04-12 13:56] upgraded libcap (1.10-2 -> 2.16-3)
[2009-04-12 13:56] upgraded avahi (0.6.24-1 -> 0.6.24-3)
[2009-04-12 13:56] upgraded cdrkit (1.1.9-1 -> 1.1.9-2)
[2009-04-12 13:56]
[2009-04-12 13:56] >>> Deluge's daemon is running with the "deluge" user. The default download directory is /srv/deluge/
[2009-04-12 13:56]
[2009-04-12 13:56] upgraded deluge (1.1.5-1 -> 1.1.6-3)
[2009-04-12 13:56] upgraded jack-audio-connection-kit (0.109.2-2 -> 0.116.2-1)
[2009-04-12 13:56] upgraded gstreamer0.10-bad-plugins (0.10.11-2 -> 0.10.11-3)
[2009-04-12 13:56] upgraded hdparm (9.12-1 -> 9.14-1)
[2009-04-12 13:56] upgraded iptables (1.4.2-1 -> 1.4.3.1-1)
[2009-04-12 13:56] upgraded kbproto (1.0.3-1 -> 1.0.3-2)
[2009-04-12 13:57] upgraded kdelibs (4.2.2-3 -> 4.2.2-4)
[2009-04-12 13:57] upgraded kernel26-firmware (2.6.28-1 -> 2.6.29-1)
[2009-04-12 13:59] >>> Updating module dependencies. Please wait ...
[2009-04-12 13:59] >>> MKINITCPIO SETUP
[2009-04-12 13:59] >>> ----------------
[2009-04-12 13:59] >>> If you use LVM2, Encrypted root or software RAID,
[2009-04-12 13:59] >>> Ensure you enable support in /etc/mkinitcpio.conf .
[2009-04-12 13:59] >>> More information about mkinitcpio setup can be found here:
[2009-04-12 13:59] >>> http://wiki.archlinux.org/index.php/Mkinitcpio
[2009-04-12 13:59]
[2009-04-12 13:59] >>> Generating initial ramdisk, using mkinitcpio. Please wait...
[2009-04-12 13:59] ==> Building image "default"
[2009-04-12 13:59] ==> Running command: /sbin/mkinitcpio -k 2.6.29-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.img
[2009-04-12 13:59] :: Begin dry run
[2009-04-12 13:59] :: Parsing hook [base]
[2009-04-12 13:59] :: Parsing hook [udev]
[2009-04-12 13:59] :: Parsing hook [autodetect]
[2009-04-12 13:59] :: Parsing hook [pata]
[2009-04-12 13:59] :: Parsing hook [scsi]
[2009-04-12 13:59] :: Parsing hook [sata]
[2009-04-12 13:59] :: Parsing hook [usbinput]
[2009-04-12 13:59] :: Parsing hook [keymap]
[2009-04-12 13:59] :: Parsing hook [filesystems]
[2009-04-12 13:59] :: Generating module dependencies
[2009-04-12 13:59] :: Generating image '/boot/kernel26.img'...SUCCESS
[2009-04-12 13:59] ==> SUCCESS
[2009-04-12 13:59] ==> Building image "fallback"
[2009-04-12 13:59] ==> Running command: /sbin/mkinitcpio -k 2.6.29-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26-fallback.img -S autodetect
[2009-04-12 13:59] :: Begin dry run
[2009-04-12 13:59] :: Parsing hook [base]
[2009-04-12 13:59] :: Parsing hook [udev]
[2009-04-12 13:59] :: Parsing hook [pata]
[2009-04-12 13:59] :: Parsing hook [scsi]
[2009-04-12 13:59] :: Parsing hook [sata]
[2009-04-12 13:59] :: Parsing hook [usbinput]
[2009-04-12 13:59] :: Parsing hook [keymap]
[2009-04-12 13:59] :: Parsing hook [filesystems]
[2009-04-12 13:59] :: Generating module dependencies
[2009-04-12 14:00] :: Generating image '/boot/kernel26-fallback.img'...SUCCESS
[2009-04-12 14:00] ==> SUCCESS
[2009-04-12 14:00] upgraded kernel26 (2.6.28.8-1 -> 2.6.29.1-3)
[2009-04-12 14:00] upgraded klibc-udev (140-1 -> 141-1)
[2009-04-12 14:00] upgraded libavc1394 (0.5.3-1 -> 0.5.3-2)
[2009-04-12 14:00] upgraded libcddb (1.3.0-3 -> 1.3.2-1)
[2009-04-12 14:00] upgraded libdatrie (0.1.2-1 -> 0.2.1-1)
[2009-04-12 14:00] upgraded libdrm (2.3.1-3 -> 2.4.9-1)
[2009-04-12 14:00] upgraded libdvdread (0.9.7-1 -> 0.9.7-2)
[2009-04-12 14:00] upgraded libfontenc (1.0.4-1 -> 1.0.4-2)
[2009-04-12 14:00] upgraded libid3tag (0.15.1b-2 -> 0.15.1b-3)
[2009-04-12 14:00] upgraded libmatroska (0.8.1-1 -> 0.8.1-2)
[2009-04-12 14:00] upgraded libmpd (0.16.1-1 -> 0.18.0-1)
[2009-04-12 14:00] upgraded libmysqlclient (5.0.77-1 -> 5.1.33-1)
[2009-04-12 14:00] upgraded libogg (1.1.3-1 -> 1.1.3-2)
[2009-04-12 14:00] upgraded libsamplerate (0.1.6-1 -> 0.1.7-1)
[2009-04-12 14:00] upgraded libthai (0.1.9-1 -> 0.1.11-1)
[2009-04-12 14:00] upgraded libx11 (1.2-1 -> 1.2.1-1)
[2009-04-12 14:00] installed libftdi (0.15-1)
[2009-04-12 14:00] upgraded lirc-utils (0.8.4-1 -> 0.8.5pre2-1)
[2009-04-12 14:00] upgraded m4 (1.4.12-1 -> 1.4.13-1)
[2009-04-12 14:00] upgraded man-db (2.5.4-2 -> 2.5.5-1)
[2009-04-12 14:00] upgraded man-pages (3.19-1 -> 3.20-1)
[2009-04-12 14:00] upgraded nvidia-utils (180.29-3 -> 180.44-1)
[2009-04-12 14:00] installed dri2proto (1.99.3-1)
[2009-04-12 14:01] upgraded mesa (7.2-1 -> 7.4-1)
[2009-04-12 14:01] upgraded mpfr (2.3.2-2 -> 2.4.1-1)
[2009-04-12 14:01] upgraded mpg123 (1.7.1-4 -> 1.7.2-1)
[2009-04-12 14:01] upgraded mysql-clients (5.0.77-1 -> 5.1.33-1)
[2009-04-12 14:01] upgraded mysql (5.0.77-3 -> 5.1.33-1)
[2009-04-12 14:01] upgraded mysql-gui-tools (5.0r12-3 -> 5.0r14-1)
[2009-04-12 14:01] In order to use the new nvidia module, exit Xserver and unload it manually.
[2009-04-12 14:01] upgraded nvidia (180.29-3 -> 180.44-1)
[2009-04-12 14:01] warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
[2009-04-12 14:01] upgraded pacman-mirrorlist (20090108-1 -> 20090405-1)
[2009-04-12 14:01] upgraded pango (1.24.0-1 -> 1.24.0-2)
[2009-04-12 14:01] upgraded php (5.2.9-2 -> 5.2.9-3)
[2009-04-12 14:01] upgraded pm-utils (1.2.4-3 -> 1.2.5-1)
[2009-04-12 14:01] installed perl-xyne-common (0.01-5)
[2009-04-12 14:01] installed perl-html-tagset (3.20-1)
[2009-04-12 14:01] installed perl-html-parser (3.60-1)
[2009-04-12 14:01] installed perl-libwww (5.825-1)
[2009-04-12 14:01] installed perl-xyne-arch (0.03-5)
[2009-04-12 14:01] ######################
[2009-04-12 14:01] ## IMPORTANT NOTICE ##
[2009-04-12 14:01] ######################
[2009-04-12 14:01] Powerpill options and configuration file syntax have changed with
[2009-04-12 14:01] version 16.0. Please remove old configuration files and use the
[2009-04-12 14:01] default configuration file at /etc/powerpill.conf as a template for new
[2009-04-12 14:01] ones. Please see the man page for information on the command-line options.
[2009-04-12 14:01] upgraded powerpill (15.12-1 -> 16.0-5)
[2009-04-12 14:01] upgraded python-numpy (1.2.1-4 -> 1.3.0-1)
[2009-04-12 14:02] upgraded qt (4.5.0-3 -> 4.5.0-4)
[2009-04-12 14:02] upgraded qt3 (3.3.8-9 -> 3.3.8-10)
[2009-04-12 14:02] upgraded redland (1.0.8-1 -> 1.0.8-3)
[2009-04-12 14:02] upgraded tdb (3.3.1-1 -> 3.3.3-1)
[2009-04-12 14:02] upgraded smbclient (3.3.1-1 -> 3.3.3-1)
[2009-04-12 14:02] upgraded subversion (1.6.0-2 -> 1.6.1-2)
[2009-04-12 14:02] upgraded syslog-ng (3.0.1-4 -> 3.0.1-6)
[2009-04-12 14:02] upgraded tzdata (2009d-1 -> 2009e-1)
[2009-04-12 14:02] upgraded udev (140-2 -> 141-1)
[2009-04-12 14:02] upgraded xf86-input-keyboard (1.3.2-1 -> 1.3.2-2)
[2009-04-12 14:02] upgraded xf86-input-mouse (1.3.0-1 -> 1.4.0-2)
[2009-04-12 14:02] upgraded xf86-video-vesa (2.1.0-1 -> 2.2.0-1)
[2009-04-12 14:02] upgraded xfce4-mpc-plugin (0.3.3-2 -> 0.3.3-3)
[2009-04-12 14:02] upgraded xorg-server-utils (7.4-3 -> 7.4-4)
[2009-04-12 14:02] upgraded xorg-utils (7.4-2 -> 7.4-3)
Last edited by siaco (2009-04-14 21:42:10)I found the error on this. In the current PGKBUILD found in AUR, the patch mysql-gui-tools.chema_change_freeze_bug.patch is no longer applied.
I downloaded all related files to this package and built it myself now, with some changes to PGKBUILD and the mysql-gui-tools.chema_change_freeze_bug.patch. It works again :-)
New PGKBUILD:
# $Id: PKGBUILD,v 1.14 2009/04/12 11:52:45 dsa Exp $
# Maintainer: Douglas Soares de Andrade <[email protected]>
# Contributor: Vinay S Shastry <[email protected]>
pkgname=mysql-gui-tools
pkgver=5.0r14
pkgrel=2
arch=('i686' 'x86_64')
pkgdesc="Set of programs to manage and interact with a MySQL server."
url="http://www.mysql.com/products/tools/"
license=('GPL')
source=(http://mirrors.uol.com.br/pub/mysql/Downloads/MySQLGUITools/$pkgname-$pkgver.tar.gz
bad-char.patch
mysql-gui-tools-sigc_2.1.1_api_fixes.diff
mysql-gui-tools-5.0_p12-deprecated-gtk+-api.patch
mysql-gui-tools-gcc43.patch
mysql-gui-tools.chema_change_freeze_bug.patch)
depends=('gtkmm' 'gtkhtml' 'libmysqlclient' 'pcre')
replaces=('mysql-administrator' 'mysql-query-browser')
conflicts=('mysql-administrator' 'mysql-query-browser')
provides=('mysql-gui-common' 'mysql-administrator' 'mysql-query-browser')
makedepends=('pkgconfig' 'lua' 'libxml2' 'libgnomeprint')
options=('!makeflags')
build() {
cd $startdir/src/$pkgname-$pkgver
# Patch from mysql.com to fix the freeze when selecting a schema
patch -p1 < ../mysql-gui-tools.chema_change_freeze_bug.patch || return 1
# Patch to make 5.0r14 compile
patch -Np1 < $startdir/src/bad-char.patch
patch -Np1 < $startdir/src/mysql-gui-tools-sigc_2.1.1_api_fixes.diff
patch -Np1 < $startdir/src/mysql-gui-tools-gcc43.patch
patch -Np0 < $startdir/src/mysql-gui-tools-5.0_p12-deprecated-gtk+-api.patch
cd $startdir/src/$pkgname-$pkgver/common
sh autogen.sh
./configure --prefix=/usr --datarootdir=/usr/share --with-gtkhtml=libgtkhtml-3.14 || return 1
make || return 1
make DESTDIR=$startdir/pkg install || return 1
cd ..
cp -R common mysql-gui-common
cd $startdir/src/$pkgname-$pkgver/administrator
sh autogen.sh
./configure --prefix=/usr --datarootdir=/usr/share --with-gtkhtml=libgtkhtml-3.14 || return 1
make || return 1
make DESTDIR=$startdir/pkg install || return 1
cd $startdir/src/$pkgname-$pkgver/query-browser
sh autogen.sh
./configure --prefix=/usr --datarootdir=/usr/share --with-gtkhtml=libgtkhtml-3.14 || return 1
make CFLAGS="${CFLAGS} -D_GNU_SOURCE" || return 1
make DESTDIR=$startdir/pkg install || return 1
#cd $startdir/src/$pkgname-$pkgver/mysql-workbench
#patch -p1 < ../../mysql-gui-tools-5.0_p12-workbench-lua.patch
#./configure --prefix=/usr --with-gtkhtml=libgtkhtml-3.14 || return 1
#make || return 1
#make DESTDIR=$startdir/pkg install
# Some adjusts to make mysql-workbench run
#cd $startdir/pkg/usr/bin
#mv mysql-workbench mysql-wb
#mv mysql-workbench-bin mysql-wb-bin
#install -m755 $startdir/src/mysql-workbench.sh mysql-workbench
#rm -rf $startdir/pkg/usr/lib/
# Fixed startup scripts
install -m755 $startdir/mysql-administrator $pkgdir/usr/bin
install -m755 $startdir/mysql-query-browser $pkgdir/usr/bin
md5sums=('b8efefbf20b7264c8f3afd34424467d7'
'4279c75bb5e6c2bfcb16c98817d55b80'
'4625629385142862cd01d37f814d5e80'
'33205d45329ab4fa4096b6b298a60b2c'
'1368384dac87bc0a64adb774ab2e6cbd'
'2ff840932405f7a6a6863f633a639fe9')
New mysql-gui-tools.chema_change_freeze_bug.patch: (only changes to paths in file. Don't know if this was really needed, but I belive so.)
diff -ruN mysql-gui-tools-5.0r11.ORIG/query-browser/source/linux/MQQueryDispatcher.cc mysql-gui-tools-5.0r11/query-browser/source/linux/MQQueryDispatcher.cc
--- mysql-gui-tools-5.0r11.ORIG/query-browser/source/linux/MQQueryDispatcher.cc 2007-02-21 01:31:19.000000000 +0000
+++ mysql-gui-tools-5.0r11/query-browser/source/linux/MQQueryDispatcher.cc 2007-11-09 15:31:38.000000000 +0000
@@ -558,8 +558,8 @@
Gtk::Main::instance()->run();
- while(!req->is_complete())
+// while(!req->is_complete())
+// ;
return sps;
I hope this helps anyone else who needs to fix this! -
I have a question to a MYSQL query (using PHP) in a site I
created for a
client.
I need to output the sum of one particular column in a table.
I created
an "exercise counter" for subscribers to this particular
page, which is
supposed to help them keeping track of how much exercise they
get. So
each day they add an amount, and it gets added up per week.
What i need to output is the total amount of exercise of all
users combined.
So I just made a query, and go through however many rows
there are in
the result and add those up.
But then I was thinking what if that table grows enourmously
in size.
(lets say there will be 100.000 subscribers and they each
count each week).
The calculating amount would be quite enormous.
So then I thought, hey the heck with it, i throw in another
table which
just contains the total amount and each time a user adds on
his count, i
just do that too...
Am I walking the long way or is my reasoning somewhat sound?
AnuragAnuragbabaji wrote:
> Steve wrote:
>> On Thu, 07 Dec 2006 18:38:20 -0500, Anuragbabaji
>> <[email protected]> wrote:
>>
>>> Am I walking the long way or is my reasoning
somewhat sound?
>>
>> All you need is the SUM function:
>>
>>
http://www.tizag.com/mysqlTutorial/mysqlsum.php
>
> looks great... BUT do you think that if the table has a
zillion rows...
> do you think the two table solution would be faster...
>
> I don't want to have to go back in five years ;)
would it be sufficient and/or adviseable to simply "index"
the column?
anurag -
I run mysql query using Java, and the results of it are put in a vector object. Due to the vector object is made by 1 element (it's sure because I wrote the database) I'd like to take it and put it in a string variable, but Java returns me a lot of exceptions; here is the code:
public Vector eseguiQuery(String query) {
Vector v = null;
String [] record;
int colonne = 0;
try {
Statement stmt = db.createStatement(); // Creo lo Statement per l'esecuzione della query
ResultSet rs = stmt.executeQuery(query); // Ottengo il ResultSet dell'esecuzione della query
v = new Vector();
ResultSetMetaData rsmd = rs.getMetaData();
colonne = rsmd.getColumnCount();
while(rs.next()) { // Creo il vettore risultato scorrendo tutto il ResultSet
record = new String[colonne];
for (int i=0; i<colonne; i++) record[i] = rs.getString(i+1);
v.add( (String[]) record.clone() );
rs.close(); // Chiudo il ResultSet
stmt.close(); // Chiudo lo Statement
} catch (Exception e) { e.printStackTrace(); errore = e.getMessage(); }
return v;
public String autentica(String query){
String s = (String) db.eseguiQuery(query).get(0);
System.out.println(s);
return s;
}...Please help me!1. You're not calling ResultSet.next() to move the result set onto the first row of results.
2. (Edit) Deleted because you were in fact closing your objects, though you should still use a finally block to make absolutely certain.
3. The exceptions tell you what the problem is - when you post a question please include these.
Edited by: dcminter on 06-Aug-2008 17:04 -
Hi,
How to convert the below oracle query to MYSQL query
Oracle Query:
SELECT b.* FROM (SELECT t2.*, MIN(t2.id) over(PARTITION BY t2.rid)ord_num
FROM (SELECT t1.id, dense_rank() over(ORDER BY nvl(t1.CLI_ID_CLIENT_EXT, 'a'||t1.id)) rid
FROM CANGEN_MATRICE_BKUP t1) t2) t, (SELECT ROWNUM , b.* FROM CANGEN_MATRICE_BKUP b) b
WHERE t.id = b.id ORDER BY t.ord_num, b.id
i dont know howto convert the MYSQL query?
Please help on this.
Regards
Sudhakar P.No MySQL haven't analytic functions. But every analytic function can be achieved with simple SQL, just one needs to write more it :)
So here is a starting point how to emulate analytic functions in MySQL
http://www.oreillynet.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html
And MySQL haven;t rowids as well, but actually I dont see any sense of it in this particular query.
Gints Plivna
http://www.gplivna.eu -
Correct syntax to write this mysql query?
Hello,
Need some help writing a mysql query that I lack the knowledge to do.
I have 2 tables, say table1 and table2. I want to take data from column (state) in table 1 and replace what is in column (state_id) in table 2.
notes:
The column names dont match.
I can match up the unique user ids from table1 to table2, they are the same.
I only want to replace data in a few columns, not the entire table, the other data must remain unchanged.
I want to tfer the data in the tables themselves from one to the other, not just compiled as a mysql query result.
Wasnt sure if i should use a merge? tried a few ways but with no luck.
anyone care to write something up i can use? im sure its easy to write, i just cant write advanced queries off the top of my head like that :-)quote:bregent: "Or did you edit the error message?" well i tried both with the table1 and without, then copied over the wrong error msg, since phpmyadmin doesnt like control + C. haha, good eye!
ok i used this query from the site:
UPDATE mIntent_profile, bought_adult
SET mIntent_profile.state_id = bought_adult.state,
mIntent_profile.city_id = bought_adult.city
WHERE mIntent_profile.profile_id = bought_adult.id
and it updated the state_id but for some reason it put all 0's in the city_id. COuldnt figure it out for a few minutes, then it dawned on me to check the type of data that could be entered into the city_id column... it was INT. changed it to VARCHAR and then it works.
thanks a lot for the push in the right direction, now the search on my clients site works much better. -
Query Help:
http://forum.java.sun.com/thread.jsp?forum=45&thread=471180&tstart=15&trange=15
It seems I have confused enough people with my improper presentation of query. Sorry guys. I will restate my question with different table names.
The above was my previous posting, which was not clear..so Iam restating my problem as follows....
I have the following tables
Customer(custID, Name, Address)
Order(custID, OrderID, orderDate)
CreditCard(custID, creditCard#, creditCardType)
Now if I have 3 records in Order with custID 100 and 2 records in CreditCard as
Order:
100,A001,11/22/03
100,A002,11/24/03
100,A003,12/02/03
CreditCard:
100,42323232..., VISA
100,5234234...., MASTER
Now how can I get
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
data in minimum no. of records....
I think I have made my query clear..
now please help me guys...
thanks so much for your help.You are right.
But frankly the actual tables on my database are not customer,orders and creditcards..but I just tried to reproduce the problem with these tables, please ignore that user needs a refund etc situtaion. If the tables were actually order,creditcards etc..it would have been a problem to be considered.
Can you please help me with the query
if I have m rows in Order and n rows in CreditCard. I will get m*n records, I looking for max(m,n).
With the following fields in my query result,
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
from Customer, Order, CreditCard tables
Thanks so much for your htlp -
Only firefox executing mysql query two times. but other browser works perfect why?
i am a web developer. and i am facing a problem only with firefox. every time i use MySQL query in my php code fire fox execute it two times. but same query is working fine on other browsers.
Yes, the problem is seen without extensions and also in safe mode.
But, I am starting to think that firefox is running low on memeory or CPU.
Without extensions the possibility of failing is 1 in 3.
I am still unable to explain why closing the browser or aborting the request can cause the stuck request to immediately reach the server.
Is there a way to collect Firefox logs and post it here ?
Maybe you are looking for
-
I just created a new Apple ID for my son (under 13 so could not have an account until new), as part of the new family sharing option in iOS 8.0.2, and I want to transfer the Game Center account he was using to the new Apple ID. I see in Settings > Ga
-
Unable to install the updated version of iTunes
Hi All. I am unable to install the updated version i.e. 10.7 iTunes. I have downloaded it and while installing process it moves until the last and rolls it back. I have uninstalled itunes and tried again. Could not downloaded. Sowhow I have donloaded
-
"Get info" on video files freezes iTunes for minutes.
When I right click a video file and select "get info", iTunes always freezes for at least 60 seconds. Then it shows the normal tag info. If I change anything and press ok it freezes again, then it works as it should (with the edited info saved proper
-
TNS:listener does not currently know of SID given in connect descriptor
Hi I have installed 11g on Windows 7, the startup & shutdown of DB is normal. But connecting to a particular DB is giving a problem: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor in the listener.ora following entr
-
MacBook Pro with OSX 10.8.5 and new Skype Installation
I have a MacBook Pro with OSX 10.8.5 and would like to install SKYPE now that I have a new granddaughter on the way. I have read all sorts of horror stories about Skype crashing the system with this operating system, etc. I have NOT installed Maveric