I have a simple query over a table, which returns results like the following:
id id_type id_ref
2702 5 31
2702 16 14
2702 17 3
2702 40 1
2703 23 4
2703 23 5
2703 34 6
2704 1 14
And I would like to merge the results into a single row, for instance:
id concatenation
2702...
Hi,
I have two tables
Employee
ID | Name | Department
----------------------
121 |Name1 | dep1
223 |Name2 | dep2
Assignment
ID | EID|
---------
1 |121
2 |223
3 |121
[other columns omitted for brevity]
The table assignment indicates which is work is assigned to whom.EID is a foriegn key to the table Employee.Also it is po...
I have two tables: a Files table, which includes the file type, and a File Properties table, which references the file table via a foreign key. Sample Files table:
| id | name | type |
---------------------
| 1 | file1 | zip |
| 2 | file2 | zip |
| 3 | file3 | zip |
| 4 | file4 | jpg |
And the Properties table:
| file_id | ...
which one is the fastest way to completely copy a table on mysql ?
CREATE TABLE copy LIKE original;
INSERT INTO copy SELECT * FROM original;
or
CREATE TABLE copy SELECT * FROM original;
ALTER TABLE copy ADD PRIMARY KEY (id);
or theres another way ?
EDIT: I'm worried about the indexes being re-created, how does mysql proceed execut...
how to find top three highest salary in emp table in oracle(sql)
...
i have a table with this columns--- Or
orgid ispaid validity noofthingstoTake
1 yes 2010-06-05 20
2 yes 2010-06-09 7
i have used this query(to join two more tableS):
select distinct B.RequirementID,A.OrganizationID
from
Organization A,RequirementsDetailsforOrganization B,validityorgdet F
where A.Or...
Have a SQL Server 2008 db which I connect to the Windows Authentication .. has worked good for 7-8 months .. but now when I come to work today it no longer worked to connect, without that I had done something
Error message was:
Can not open user default database. Login failed.
Login failed for user 'Jimmy-PC \ Jimmy'.
where the first...
In SQL Server, it is possible to test the result of a stored procedure to know if the result return rows or nothing ?
Example :
EXEC _sp_MySp 1, 2, 3
IF @@ROWCOUNT = 0
BEGIN
PRINT('Empty')
END
ELSE
BEGIN
PRINT(@@ROWCOUNT)
END
But @@ROWCOUNT always return 0 so maybe is there another way of doing this ?
...
As the name says, force the alter database to alter its collation ignoring the error message that I get from functions or calculated columns that compare data.
Is there a way to do so?
Like IGNORE_ERRORS or something like that?
Thanks a lot!
...
Hi, i have a problem with selecting some values from my DB. DB is in design stages so i can redesign it a bit of needed.
You can see the Diagram on this image
Basically what i want to select is
select
c.campaignID,
ct.campaignTypeName,
c.campaignName,
c.campaignDailyBudget,
c.campaignTotalBudget,
c.campaignCPC,
c.date,
cs.campaignSta...
I am making a test. I have all tests in rows, so my rows looks like this;
ID | TEST
----------------------------------
1 | 'select sysdate from dual'
2 | 'select sysdatesss from dual'
Now I read it row by row and I need to test it with EXPLAIN PLAN FOR
so the for the first row it would be
EXPLAIN PLAN FOR select sysdate fro...
Let say I got the following :
DECLARE @ExcludedList VARCHAR(MAX)
SET @ExcludedList = 3 + ', ' + 4 + ' ,' + '22'
SELECT * FROM A WHERE Id NOT IN (@ExcludedList)
Error : Conversion failed when converting the varchar value ', ' to data type int.
I understand why the error is there but I don't know how to solve it...
...
My application is using a search function, sometimes the search may return a result set with thousands of items, therefore I am using lazy loading and only retrieving the primary keys.
The problem is that my application is localized, and I need to sort this primary keys alphabetically using another column in the table that has a name t...
I've created a function for converting minutes (smallint) to time (varchar(5)), like 58 -> 00:58.
set QUOTED_IDENTIFIER ON
GO
Create FUNCTION [dbo].[IntToMinutes]
(
@m smallint
)
RETURNS nvarchar(5)
AS
BEGIN
DECLARE @c nvarchar(5)
SET @c = CAST((@m / 60) as varchar(2)) + ':' + CAST((@m % 60) as varchar(2))
RETURN @c
E...
Possible Duplicate:
What are views good for?
hi,
i have a doubt what is a view. where should we use and what is the use of view.
is there any good reference for views. thank you
...
Hi,
I'm having scenario to which a sql query need to be built. I tried to come up with a efficient query, but could not find a clear way of doing this. My scenario is as follows:
I'm having TABLE_A and TABLE_B ,where FIELD_AB will definitely be a filed of TABLE_A, however, there can be exist FIELD_AB in TABLE_B.
I need to retrieve val...
So Im using Tapestry and trying to store a date from a beaneditform into a simple Access database. It wont work, Im getting Null pointer exceptions and I cannot understand why.
String onSuccess()
{
System.out.println("in on success!");
String nextPage = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection =...
So I have a one list box with values like DeptA, DeptB, DeptC & DeptD. I have a method that causes these to automatically populate in this list box if they are applicable. So in other words, if they populate in this list box, I want the resulting logic to say they are "Yes" in a boolean field in the table.
So to accomplish this I am try...
I know how to create a row in Table B for every row in Table A:
INSERT INTO [dbo].[TableB] SELECT 0, 5, 3, [TableAColumn] FROM [dbo].[TableA]
But I need to also put the ID of each new TableB row into a column in TableA, and I can't figure out how to do that.
[Edit] I forgot to mention that there are 3 TableB IDs referenced to TableA,...
I want to be able to pass in the name of a stored procedure as a string into another stored procedure and have it called with dynamic parameters. I'm getting an error though.
Specifically I've tried:
create procedure test @var1 varchar(255), @var2 varchar(255) as
select 1
create procedure call_it @proc_name varchar(255)
as
...