I have two tables that I am joining with the following query...
select *
from Partners p
inner join OrganizationMembers om on p.ParID = om.OrganizationId
where om.EmailAddress = '[email protected]'
and om.deleted = 0
Which works great but some of the columns from Partners I want to be replaced with similarly named columns f...
i need to do this :
There is a table called table1 it has a employee id column,status column which has values 1 and 0 only and a department column with values 100,101,102.
i want to list all employeeid with the status = 0 and (department=100 whose status=1)
Please help me
...
i dont understand the problem with returning multiple rows:
here is my table BBC:
name region area population gdp
Afghanistan South Asia 652225 26000000
Albania Europe 28728 3200000 6656000000
Algeria Middle East 2400000 32900000 75012000000
Andorra Europe 468 64000
Angola Africa 1250000 14500000 1493500000...
i need to do this :
There is a table called table1 it has a employee id column,status column which has values 1 and 0 only and a department column with values 100,101,102.
i want to list all employeeid with the status = 0
from the above list i want to filter the employees which having (department=100 and whose status=1)
Extended que...
I need to duplicate one row changing the PK.
The table can be different in each client installation, so I can't just enumerate the columns.
I've managed to do the following:
INSERT INTO table SELECT * FROM table WHERE PK='value'
but obviously it fails because I'm trying to duplicate the PK.
Then I tried:
INSER INTO table SELECT 'new...
How to create TIMESTAMPS for SQL query for it to be sortable by date from PHP?
So I have table created by such SQL script
CREATE TABLE `Keys` (
`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`KEY` INT NOT NULL ,
`TIMESTAMP` DATE NOT NULL ,
UNIQUE (
`KEY`
)
)
What sript should I write to:
Add timestamps
To sort\search thru that ...
I have a varchar(100) column in a table that contains a mix of integers (as strings) and non-integer strings. E.g.
| dimension varchar(100) |
| '5' |
| '17' |
| '3' |
| 'Pyramids' |
| 'Western Bypass' |
| '15' |
How can I write an expression to...
Hello guys,
here is a simple problem. I have a table of 500 rows and what to be able to select a given row number n. This is what I am doing:
select *
from table
where table.arg1 ='A'
and time_stamp=to_date('1/8/2010','MM/DD/YYYY')
and rownum = n
But it would only work for the row 1, for the rest it doesn't return...
It's easy enough for me to read through a small SQL Server 2005 table like this:
string cmdText = "select * from myTable";
SqlDataAdapter adapter = new SqlDataAdapter(cmdText, connection);
DataTable table = new DataTable();
adapter.Fill(table);
Unfortunately, this method appears to load the entire table into memory, which simply isn't...
Hi,
Say I have a very long table (~35 million rows) called TimeCard with only 5 columns (tableID, CompanyID, UserID, ProjectID, DailyHoursWorked, entryDate). This is a pretty straight forward table that records employees' worked hours per day per project per company.
I now need to generate a report to find out the employees' total wo...
I have three tables specifying important columns below
Users(Id, username)
Groups(Id, groupname, creator) (creator is the creator of the group)
Association(Id, UserId, GroupId) (entries in this table include which user is in which group)
Association.UserID =Users.Id, Association.GroupId = Groups.id and also Groups.creator = Users.Id....
Hey all.
I have a project here the goal is to merge multiple Access DB's into one SQL Server db. Some of the records in the Access DB are autonumber, and will not be unique across all the DB's.
We are currently working on modifying those autonumber fields programmaticaly to being number fields. The adjusting and allowing access to casc...
OMG! What am I doing wrong?
declare @WTF TABLE (
OrderItemId int
)
SELECT TOP 20 OrderItemId as OrderItemId INTO [@WTF] FROM ac_OrderItems
SELECT * FROM [@WTF]
Problem A: This creates a PHYSICAL table called @WTF. WHY?? I thought this was in memory only?!
Problem B: The last line of code, if I do select * from @WTF... WITHOUT the ...
In our report generation application, there's some pretty hefty queries that take a considerable amount of time to run. User feedback up until this point has been basically zip while the server chugs away at their request. I noticed that there's a tab on the ADA Management Utility that shows progress on the query both as percent comple...
I'm using Squirrel SQL with Oracle. I often have to write quick queries for tables with longish names. It would be nice if I could give aliases to them and write queries like "select * from ft where n='blah'" instead of "select * from footablelongname where nameField='blah'".
I wouldn't use that sort of thing in applications, but it wou...
Hi, I have a table of Prices with a start date, end date and price. I want a search to pass in a date range and return whether a price exists for all days in that range. The date range can span multiple prices, just not have any gaps in between.
Is this possible?
Prices
startDate datetime
endDate datetime
price
DECLARE @startDate dat...
Let's pretend I have a large recipe-database. A table for recipes each with an unique ID and a table for ingredients with a whole lot of sets like this:
ID | RECIPE | INGREDIENT
-------------------------------
1 | recipe_a | ingredient_a
2 | recipe_a | ingredient_b
3 | recipe_a | ingredient_c
4 | recipe_b | ingredient_a
...
I understand the point of group by x
But how does group by x, y work and what does it mean?
...
I am attempting to pass a text box value into a SQL query, something which just does not want to work for me. The error I receive is 'End of statement expected.'
I presume it is a syntax error on my behalf, I am brand new to ASP and would be grateful if someone could point out where I am going wrong. Below is the code that is causing th...