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...
EDIT: the database is Access 2007
Hi, I'm new here and I need some help:
I have three tables:
technicians (Id, tech_name, is_active)
type_services (Id, serv_name, is_active)
services (Id, date_time, prod_name, quantity, serv_type, tech_name, is_active)
I have to make a report that contain:
Number of services per tech (SUM(quantit...
From a dropdown menu a user can choose: view all, athletic, dress, or sandals. I am creating a function that if the user chooses athletic--only the Product Type 'Athletic', only athletic items from the database will be shown.
Right now, because how my code is written, if the user selects 'Athletic' they will see athletic items, but also...
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.
...
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've an IList with 5 items. I need to insert these, looping one by one, from the list to a SQL Server table using ado.net. I am using IReader(enterprise library)
How can I do this?
...
There is a column in options that hold an integer. I want to select the row only if that value % 2 = 1.
I know this can be done in 2 queries but is it possible to do it in 1?
...
Sorry for the long title and perhaps confusing half good now as we come. I'm asking advice or guidance on how I can get an RSS feed from a page that does not have RSS enabled by default. But that is not the problem itself. The problem is when on that page I am asked to enter a username and password. Well so otherwise would be the thing....
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...
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.
...
Hi, I am not sure how to make an automaticed script that incrments all dates in a database. I was asked if the date is Friday, the script needs to increment the next business date to Monday, so I will need some logic in the script.
This can be easily done in C# or any other programming language. But, I was required that the script must ...
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
...
I want to know the difference between these two statements. Is one 'better' than the other ?
DECLARE
myvar varchar2(50);
BEGIN
SELECT fieldone into myvar FROM tbl_one WHERE id = 1;
END;
AND
DECLARE
CURSOR L1 IS
SELECT fieldone FROM tbl_one WHERE id = 1;
BEGIN
OPEN L1;
FETCH L1 INTO myvar;
CLOSE L1;
END;
...
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
...
hi,
I have a Tariffs table for international dialing Codes
with StartDate and EndDate
I'm using ASP.net Application to import excel offers to this table , Each offer contain about 10000 row, so it is a large table (about 3 millions row)
what is the faster scenario in SQL Server 2008 to create a stored-procedure or trigger to change the...
I don't have much experience in SQL so I think this is not a dumb question.
I have 2 tables like this.
A .. G are the members of a hierarchy.
Now my requirement is as follows.
I need to filter out the members which
has status = 0 from Members table.
But, If the selected set contains
children which has a parent with
st...
Hi there!
I'm currently having a problem. I need to update Table A from Table B based on this condition:
If one record in Table A is null (ex. name) then update that record from Table B
Here's my error driven script which I thought from my head. This is what I wanted to happen.
UPDATE TableA
SET
NAME =
(
CA...
I am calling an SSIS package remotely using a stored procedure and a call to xp_cmdshell:
declare @cmd varchar(5000)
set @cmd = '"C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\dtexec.exe" /Rep E /Sql Package /SET \Package.Variables[User::ImportFileName].Value;c:\foo.xlsx'
print @cmd
exec xp_cmdshell @cmd
This works fine, ho...