CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> .NET

 Retrieve value from unjoined table

Print topic Send  topic

Author Message
kescott


Posts: 49
Posted: 10/03/2008, 5:56 AM

:-|

I have two unjoined tables called EMP and SMP. The tables are defined as such:

Emp
emp_id int(15) autoinc
name varchar(30)
smp_complete bit(1)


Smp
smp_id int(15) autoinc
name varchar(30)
complete bit(1)

I'm trying to retrieve the value from SMP.complete and display that value in EMP.smp_complete in the grid for the EMP dataset, but I believe I'm missing something because I can't retrieve any values. Should I write a SQL statement listed below to get the results shown below in my example?

My proposed SQL statement doesn't work.
SELECT complete FROM Smp WHERE Emp.name = Smp.name

For example:
//----
|EMP____________________|
|-----------------------------------------|
|emp_id|name |smp_complete|
|10____|Bob__|1___________|
|11____|Jane_|0___________|
|14____|Ann__|1___________|
|------------------------------------------|


//----
|SMP____________________|
|-----------------------------------------|
|smp_id|name |complete____|
|20____|Bob__|1__________|
|44____|Ann__|1__________|
|31____|Jane_|0__________|
|----------------------------------------|


_________________
B.S. of Computer Science
Class of 2005
Norfolk State University
Norfolk, VA
http://www.nsu.edu
View profile  Send private message
dragoon


Posts: 173
Posted: 10/03/2008, 11:32 AM

SELECT complete FROM Smp inner join Emp on Emp.name = Smp.name
View profile  Send private message
Trigger
Posted: 10/04/2008, 7:18 PM

You have to name all of the tables that you are going to use in the FROM
clause .

SELECT complete FROM Smp, Emp WHERE Emp.name = Smp.name

This SQL style is the old way of doing joins and the WHERE clause is
usually refered to as a constraint. But it still works in simple examples.

A new format was implemented in the later versions of SQL that
use INNER JOIN syntax.

Tim


"kescott" <kescott@forum.codecharge> wrote in message
news:848e61670edcde@news.codecharge.com...
> :-|
>
> I have two unjoined tables called EMP and SMP. The tables are defined as
> such:
>
> Emp
> emp_id int(15) autoinc
> name varchar(30)
> smp_complete bit(1)
>
>
> Smp
> smp_id int(15) autoinc
> name varchar(30)
> complete bit(1)
>
> I'm trying to retrieve the value from SMP.complete and display that value
> in
> EMP.smp_complete in the grid for the EMP dataset, but I believe I'm
> missing
> something because I can't retrieve any values. Should I write a SQL
> statement
> listed below to get the results shown below in my example?
>
> My proposed SQL statement doesn't work.
> SELECT complete FROM Smp WHERE Emp.name = Smp.name
>
> For example:
> //----
> |EMP____________________|
> |-----------------------------------------|
> |emp_id|name |smp_complete|
> |10____|Bob__|1___________|
> |11____|Jane_|0___________|
> |14____|Ann__|1___________|
> |------------------------------------------|
>
>
> //----
> |SMP____________________|
> |-----------------------------------------|
> |smp_id|name |complete____|
> |20____|Bob__|1__________|
> |44____|Ann__|1__________|
> |31____|Jane_|0__________|
> |----------------------------------------|
>
>
> _________________
> B.S. of Computer Science
> Class of 2005
> Norfolk State University
> Norfolk, VA
> http://www.nsu.edu
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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