Hi
Im wondering if someone could help me out with how to write sql for the following type of query.
I have 3 known strings of characters and three associated sql queries. The queries will always return an integer.
I want a table so that column 1 is the list of known strings, and column 2 is the results of the three queries.
Thank youcreate table mytable
( string varchar(100)
, result integer
)|||Or maybe something like this:
create table mytable
( string varchar(100)
, result integer)
AS
select string, SUM(result) from (
select string, result from query1
UNION ALL
select string, result from query2
UNION ALL
select string, result from query3)
group by string;
:D
Showing posts with label strings. Show all posts
Showing posts with label strings. Show all posts
Tuesday, March 27, 2012
Sunday, March 25, 2012
Create Table
Hello,
I have 2 tables:
[Categories] > CategoryId, Category
[Strings] > String
I want to create a new table as follows:
[CategoriesFound] > CategoryId, CategoryFound
The "CategoryFound" column in this table is filled with all the
"String" records in Strings.
Then the CategoryId is taken from table Categories where
Categories.Category = Strings.String.
How can I do this?
Miguel
INSERT INTO CategoriesFound (CategoryId, CategoryFound)SELECT CategoryId, CategoryFROM Categories CJOIN Strings SON C.Category = S.String
Subscribe to:
Posts (Atom)