CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Grid from several tables...

Print topic Send  topic

Author Message
pr3mium

Posts: 31
Posted: 01/29/2004, 6:31 AM

Hi, all.

I'm creating a new employee directory for our intranet. Some of the employees' data like names, professions, birthdays, etc are replicated from Scala accounting software's database from another SQL server to the SQL server, where I make my client/server solutions. Because our company has several smaller companies, then the names of each company's employees are in separate tables, although all the names of the tablefields are identical.
So, I have 4 tables with same design, but different data. I'd like to query those tables to the CCS grid, so that it would display all the names one after another, like they were queried from one table. In a word, how could I query these tables as they were one? This might be a stupid question, so may be you could enlighten me. I don't have much experience with advanced queries and joins, so I need some help here.

I work with MSSQL 2000 and ASP 3.0 w/templates.
View profile  Send private message
Don Safar
Posted: 01/29/2004, 6:54 AM

In the query builder for the grid select sql as query type and Use the union
statement as follows

select field1, field2, field3 from table1 where (condition)
Union
select field1, field2, field3 from table2 where (condition)
Union
select field1, field2, field3 from table3 where (condition)
Union
select field1, field2, field3 from table4 where (condition)
order by (fields)


"pr3mium" <pr3mium@forum.codecharge> wrote in message
news:24019192805a8a@news.codecharge.com...
> Hi, all.
>
> I'm creating a new employee directory for our intranet. Some of the
employees' data like names, professions, birthdays, etc are replicated from
Scala accounting software's database from another SQL server to the SQL
server, where I make my client/server solutions. Because our company has
several smaller companies, then the names of each company's employees are in
separate tables, although all the names of the tablefields are identical.
> So, I have 4 tables with same design, but different data. I'd like to
query those tables to the CCS grid, so that it would display all the names
one after another, like they were queried from one table. In a word, how
could I query these tables as they were one? This might be a stupid
question, so may be you could enlighten me. I don't have much experience
with advanced queries and joins, so I need some help here.
>
> I work with MSSQL 2000 and ASP 3.0 w/templates.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Sixto Luis Santos
Posted: 01/29/2004, 6:55 AM


Use a UNION query. For example,

SELECT emp_id,emp_name,emp_birthday FROM employees_1
UNION
SELECT emp_id,emp_name,emp_birthday FROM employees_2

Or use Query Analyzer to create a VIEW then use that from CCS:

CREATE VIEW Master_Employee_List
AS
SELECT emp_id,emp_name,emp_birthday FROM employees_1
UNION
SELECT emp_id,emp_name,emp_birthday FROM employees_2

Regards,

Sixto

"pr3mium" <pr3mium@forum.codecharge> wrote in message
news:24019192805a8a@news.codecharge.com...
> Hi, all.
>
> I'm creating a new employee directory for our intranet. Some of the
employees' data like names, professions, birthdays, etc are replicated from
Scala accounting software's database from another SQL server to the SQL
server, where I make my client/server solutions. Because our company has
several smaller companies, then the names of each company's employees are in
separate tables, although all the names of the tablefields are identical.
> So, I have 4 tables with same design, but different data. I'd like to
query those tables to the CCS grid, so that it would display all the names
one after another, like they were queried from one table. In a word, how
could I query these tables as they were one? This might be a stupid
question, so may be you could enlighten me. I don't have much experience
with advanced queries and joins, so I need some help here.
>
> I work with MSSQL 2000 and ASP 3.0 w/templates.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

pr3mium

Posts: 31
Posted: 01/30/2004, 3:45 AM

Thanks to both of you, this query works just fine!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.