I have a table
id, name, keyword
1 bob guy
2 bob developer
3 mary girl
4 joe guy
Q1 : What would be the sql to get back the row (bob) containing both keywords 'guy' AND 'developer'?
Intuitively, I thought it'd be SELECT * FROM TABLE WHERE keyword = 'guy' AND keyword = 'developer'
Q2: But I suppose the first cond...
First Select Statement:
SELECT
dbo.FG_FILLIN.PartNumber,
dbo.DropshipPackinglist.Shiplist_Qty,
dbo.DropshipPackinglist.Quantity
FROM dbo.FG_FILLIN INNER JOIN
dbo.DropshipPackinglist ON
dbo.FG_FILLIN.PartNumber = dbo.DropshipPackinglist.PartNumber
WHERE (dbo.FG_FILLIN.Batch = 'CIP_HK_6')
GROUP BY
dbo.FG_FILLIN.Batch,
d...
I have two tables:
books: [isbn, book_title, publisher, ...]
inventory: [isbn, date, num_changed]
I want to return book titles for those which are on stock. I tried a join (query 1) and got 1054 error, then I substituted the reference with the literal value and now I get 1111 error.
query 1:
SELECT `books`.`isbn`, `books`.`book_t...
Is there any command that I can locate a certain table from all databases? Since I forgot where the table is. Thanks.
...
I am creating a blog post scheduling system using CodeIgniter. I want 10 posts to show up a day. There is a field in the posts table named scheduled_date which I will get the posts that are less than or equal to the current date. When an admin user adds a new record to the database, I need an SQL statement that somehow will help me COUNT...
code:
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
-- Table mydb.SEX
CREATE TABLE IF NOT EXISTS `my...
I have a MySQL Database of more or less 100 teachers, their names, and their phone numbers, stored in tables based upon their department at the school. I'm creating an iPhone app, and I've found that UITableViews and all the work that comes with it is just too time consuming and too confusing. Instead, I've been trying to create a web pa...
Hello,
I have a project that works well.
After changing the mysql connector version of the project shows warnings like this "Warning 1 Could not load file or assembly 'MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. O sistema não conseguiu localizar o ficheiro especificado...
I am struggling with the code from few days can anyone help
std::string str=uri_req1.substr(found+1);
char query[2000];
sprintf(query,"Insert into publish VALUES('%s','NO')",str);
I am getting following warnings and value is not inserted in the tables
warning: cannot pass objects of non-POD type ‘struct std::string’
through ‘...’; ca...
I want to create a rollback button in my django project using MySQLdb. I have tried to use commit() and rollback() with InnoDB as database engine, rollback() seems not work because the database was updated even though rollback() was put after commit(). Here is some related lines in python code:
def update(request):
if 'weight' in r...
I have a table with an id column (unique, primary), a name (not unique--in fact, most likely repeated), and a flag column which has values 0, 1, or 2. Let's say I reorder the table using the command
SELECT id, name, flag ORDER BY name, id
I want to produce using SQL a list of names where, when the rows in the reordering are read downw...
hey guys
i have two mysql tables which are linked together and i need to show my category list
table_stories
sid || title || time || hometext || associated
1 || test || 2010-07-19 || text---- || 8-14-
table_topics
topicid || topicname || slug
1 || car || car
4 |...
I need to run a report grouped by week. This could be done by using group by week(date) but the client wants to set the day of the week that marks the end of week. So it can be Tuesday, Wednesday etc. How can I work this into a group by query?
The datetime column type is unix timestamp.
...
To start off, this really isn't CodeIgniter specific. I'm having trouble grasping an idea, so anyone that knows PHP/SQL (or whatever my problem is) can jump in.
I have 2 tables, 'Photo' and 'Album'.
Album columns : ID TITLE USER_ID CREATED MODIFIED
Photo columns : ID ALBUM_ID TITLE LOC CREATED MODIFIED
I'm using the query
...
SELECT id, <X> AS name FROM `table`
Basically <X> is a combination of
lastname + ', ' + firstname
example would be
id | name |
2 | Smith, Bob |
3 | Jones, Susy |
This is just an example, I don't really want to combine names so simple.
...
I would like to know how I can set the MySQL time zone to UTC (SET time_zone = 'UTC') from within Symfony/Doctrine, so when I call a UNIX_TIMESTAMP() function on a DATETIME field in my query, it returns the UTC unix time and not unix time in the server's time zone.
How can I do this, either automatically upon every connection, or manua...
Hi
I want to upload data through CSV files in my contact management application. The CSV file structure is like this:
Name, Phone, City
John Doe, 555-555-5555, New York
While the table structure in the db is like this:
name, phone, city_id
In the database, the city name is stored in another table and the foreign key is referenced ...
Let's say I have two tables:
Table 1 has the columns NOTE_ID (a unique key) and NOTE_BODY (a big text blurb).
Table 2 has the columns KEYWORD_ID (a unique key) and KEYWORD (a keyword).
I want to get a result set that tells me which keywords each NOTE_BODY contains, without nesting a bunch of loops. So ideally I would get a row for ea...
Following is the query which is hit every table has over 100,000 records.
SELECT b.login as userEmail, imgateway_instance_id as img, u.id as userId
FROM buddy b
INNER JOIN `user` u ON b.username = u.login
INNER JOIN bot_to_buddy btb ON b.id = btb.buddy_id
INNER JOIN bot ON btb.bot_id = bot.id
WHERE u.id IN 14242
...
I have a MySQL table with 2 fields:
pd_code and pd_sort (pd_sort default value=0). For each product it is possible to specify an order index (in pd_sort) -1000, -900 and so on.
So when I print out products in PHP, i would like to sort them out like this.
product1 (pd_sort = -100), product2 (pd_sort = -90) etc, and then the rest produc...