What I'm trying to do is I have my tables structured like so:
The Monkees - I'm A Believer
The Monkees - Daydream Believer
The Beatles - Hello, Goodbye
The Beatles - Yellow Submarine
With the artist and title names in the same row and I'm trying to display them like this in the search results:
The Monkees:
I'm A Believer
Daydream ...
$sql2 = "SELECT `id` FROM `saa_game` WHERE `domain_id` = '".$row['id']."' AND `unique_id` = '".s($oGame->unique_id)."' AND `year` = '".$iYear."' AND `month` = '".$iMonth."' LIMIT 1";
$result2 = mysql_query($sql2) or die(mail('[email protected]','SAA Gather Error',mysql_error()));
if(mysql_num_rows($result2) == 1)
{
$row = mysql_fetc...
This is more of a theory question.
If I'm running 50,000 queries that insert new rows, and 50,000 queries that updates those rows, which one will take less time?
...
I want to be able to do something like this
SELECT `first_name` + " " + `last_name` as `whole_name` FROM `users`
So basically I get one column back whole_name which is first_name and last_name concatenated together with a (space).
How do I do that in SQL, or more specifically, MySQL ?
Thanks
...
<?php
include "db.php";
$username=$_POST['username'];
$email=$_POST['email'];
$query="SELECT * FROM members where username = '".mysql_real_escape_string($username)."'";
$result=mysql_query($query)or die(mysql_error());
$user = mysql_fetch_assoc($result);
mysql_close();
?> <br /> <p></p>
Welcome back! Your details below: <br /><b...
I need your help building a SQL statement I can't wrap my head around.
In a database, I have four tables - files, folders, folders_files and links.
I have many files. One of them is called "myFile.txt".
I have many folders. "myFile.txt" is in some of them. The first folder it appears in is called "firstFolder".
I have many links to m...
Hey there,
I am trying to connect Mysql using "mysql-connector-java-5.1.13". I have downloaded it and put it to the lib of a project that i am working on Netbeans. And i found a free host and create and Mysql database. And now i am trying the following code;
import java.sql.*;
public class MysqlConnect
{
public static ...
What is the purpose of this line?
It does not return a value or set the state of an existing class/object (or is it?)
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
...
I'm an admitted newbie with stored procedures. The following is generating a syntax error.
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3"
CREATE PROCEDURE get_user_association_list (IN uid INT)
BEGIN
DECLARE rolelist VARCHAR(255);
DECL...
which is a better place to upload images to? A database or in the web directory? And why?
...
I'm fairly inexperienced in SQL and this seems like it must be an easy task, but I'm not sure how to go about it.
Basically I want to select a single row from table A where field "someField" is in a pre-determined set "someSet", but I want it to look for each value in the set individually. For example, let's say "someSet" contains 5, 6,...
I have a table that is structured the following way (that i can't change):
EventName, LocalTime, Timezone
Data would be something like this:
Event1, 10:00, ET
Event2, 11:00, ET
Event3, 12:00, ET
Event4, 10:00, CT
how can i write a sql to sort this by actual time so result would be like:
Event1, 10:00, ET
Event2, 11:00, ET
Event4, 1...
I'm just wondering how to implement database views in Ruby on Rails. Can you guys put some working example? And thank you for every advises and examples.
...
I'm developing an app using Zend Framwork using Git for version control.
What is the best approach for updating the schema and the database when one of us makes an update to the db structure?
currently, we have to blow out the tables and recreate them manually to reflect the new updates.
...
This comes up a lot, and I can see it's come up on StackOverflow for XSLT, Ruby and Drupal but I don't see it specifically for SQL.
So the question is, how do you sort titles correctly when they begin with "The", "A", or "An"?
One way is simply to TRIM() those strings:
ORDER BY TRIM(
LEADING 'a ' FROM
TRIM(
LEADING 'an ' FR...
Hi everyone,
I have two tables tbl_a and tbl_b and their fields are
tbl_a
-----
a_id a_name a_surname a_c_id a_d_id
tbl_b
-----
b_id b_name b_phone b_c_id b_d_id
I want to join these two table like this:
select *from tbl_a join tbl_b on tbl_a.a_c_id=tbl_b.b_c_id AND tbl_a.a_d_id=tbl_b.b_d_id where tbl_a.id>15;
As you can see i w...
HI! Team,
I am quite new to MYSQL, i am trying to setup a DB and in few table with a japanese character, when i just copied the japanese characters and inserted, when i looked that into the database it all looks like ?????. I have changed all the collation propertied and chanracter properties to utf8 here is how it looks
+-------------...
I am using this connection string,
<add name="connectionString" connectionString="server=10.1.1.16;user id=root;
password=lmslive; database=lmslive; pooling=false;"
providerName="MySql.Data.MySqlClient"/>
and this database lmslive is in a system next to mine connected via proxy.... And i executed this query on that system,
G...
Hello Everyone,
Can anyone help me to take incremental backup in mysql.
i had some idea about that but it is not cleared in my mind ,
please give solutions in steps
Thanks in advance!!!
Riddhi
...
i have a lot of tables that start with some prefix ,
and i want to alter this tables
what is the simple way to do this (instead run over all tables)
i mean something like :
ALTER TABLE LIKE tablenameprefix% ADD INDEX `NewIndex1` (`field`);
how can i do this ?
thanks
EDIT :
can i do a kind of loop not in stored procedure ?
by...