I have two MySQL tables, $database1 and $database2. Both have a field in them called ID. I am passing the name of a town to the file using GET (i.e. it's in the URL of the PHP file that holds this code).
I can run this query...
$PlaceName = $_GET['townName'];
$PlaceName = mysql_real_escape_string($PlaceName);
$sql="SELECT * from $da...
I need to update the first digit of numbers.
For example, 3003.
I only want the first '3' to be changed to '2' and don't want the last digit '3' to be changed.
Something like the following faulty query:
update table
set defaulttopicorder = replace(defaulttopicorder, left(defaulttopicorder,1), 2)
where ....
...
I have a table with 16 columns. It will be most frequently used table in web aplication and it will contain about few hundred tousand rows. Database is created on sql server 2008.
My question is choice for primary key. What is quicker? I can use complex primary key with two bigint-s or i can use one varchar value but i will need to con...
Is there a way in SQL Server to list all the views within a database that join from a particular object?
ie: find all the views that join from the table myTable
...
Is there analog og the MySQL's time_to_sec() ?
I heed to perform query like the following on H2 database:
select * from order
join timmingSettings on order.timmingSettings = timmingSettings.id
where (order.time-timmingSettings.timeout) < current_timestamp
...
Hello,
How do I make a diacritic insensitive,
ex this persian string with diacritics
هواى بَر آفتابِ بارِز
is not the same as with removed diacritics in mySql
هواى بر آفتاب بارز
Is there a way of telling mysql to ignore the diacritics or do I have to remove all the diacritics in my fields manually?
...
We're upgrading a large site, opendemocracy.net, from Drupal 4.7 to Drupal 6. Our existing install has a lot of superfluous tables in the database from once-used modules we won't be using: ideally, we wouldn't keep these, or our old blocks, etc. This is because: (a) it'd be nice to keep the database as small as possible, (b) it'd be nice...
I am trying to setup a contacts database for mailings and I am trying to fully automate the labels but can't figure out how.
Where in the database would I store the name that would appear on the top of a mailing label:
mr & mrs joe thomson
dr. and mrs james berry
Schwartz family
This seems like it would have to be a calculated field...
I have a query which searches two separate fields in the same table... looking for locations which are most likely a specific city, but could also be a country... ie the need for two fields.
Table looks like:
Country City
Germany Aachen
USA Amarillo
USA Austin
Result:
Keyword Sideinfo
Aachen Germany
USA ...
I need to convert an oracle table into xml and then return it to table form.
I converted a table using xmlgen, but I don't know how to reverse the conversion. I'm looking for an example of converting an xml file into a table.
...
I'm trying to create a query that will select one item for first category, two items for second and 2 items for third category, for others just one item.
The problem is it has to be one query. I think this is possible but I just can't figure it out.
...
How do I drop all empty tables from a MySQL database leaving only the tables that have at least 1 record?
...
Is it possible to rename a MySQL table? If so, how?
...
I have a very simple application with two tables, ParentTable and ChildrenTable. Each child in the table has a foreign key to a parent (parent-child relationship is one-to-many).
When I display a form with parent info, I want to display a ListBox with all the parents children.
I already got a ListBox that displays all the children, but...
Does anyone know of a MySQL query that returns the server's current load average?
...
In MySQL, how can I compare two strings and get matching percentage. Something like this:
compare(needle, haystack) = percentage
compare("foo", "food") = 0.75
compare("foo", "foobar") = 0.5
compare("foo", "foofoo") = 1.0
compare("foo", "fo") = 0.0
I hope you get the idea :)
...
I can delete record with this SQL clause
DELETE FROM TABLE WHERE ID = 2
Anyway i want to leave always one record if table count = 1 even if "ID=2". Thank you for help already now.
...
I'm working on an app that generates reports that are basically standard SQL operations (sum/average on data grouped by A/B where X=Y etc)
the parts of the query can be defined by the user at runtime. as implemented, the raw data is in a a DataTable and I "parse" the query parameters into a linq expression (basically query operands map ...
Hello,
I have a specific row in my database, with the following information:
data:
user_id start_time end_time
405 12:00:00 14:00:00
I have the following SELECT statement:
SELECT *
FROM data
INNER join users on users.user_id = data.user_id
WHERE NOT EXIST...
I'm trying to do a MySQL request to retreive a 2 level menu (parent and children)...
There's only 1 table, of course :
idCategory | Title | idCategoryParent | DisplayOrder
1 | cat1 | NULL | 1
2 | sub-cat1 | 1 | 1
3 | sub-cat2 | 1 | 2
4 | cat2 | NUL...