Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > SQL statement using two tables

Reply
Thread Tools

SQL statement using two tables

 
 
Maximus
Guest
Posts: n/a
 
      03-19-2007
I need some help with a SQL statement. I currently have which works:

strSQL = "SELECT * FROM mstJobs WHERE JobStatus = True"

I need to query against a second table but I am not sure of the
correct syntax of the statement for adding another table.. somthing
like this i would imagine... ????

strSQL = "SELECT * FROM mstJobs.pmdata WHERE JobStatus = True AND
WHERE WeekEnding IN tblSuperInput.pmdata = strThursday"

Any help or direction would be appreciated.

Thanks

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      03-19-2007
Maximus wrote:
> I need some help with a SQL statement. I currently have which works:
>
> strSQL = "SELECT * FROM mstJobs WHERE JobStatus = True"
>

Don't ask a database-related question without telling us what database
type and version you are using.

Given that "WHERE JobStatus = True " does not raise an error, I am going
to assume you are using a Jet (Access) database.

> I need to query against a second table but I am not sure of the
> correct syntax of the statement for adding another table.. somthing
> like this i would imagine... ????
>
> strSQL = "SELECT * FROM mstJobs.pmdata WHERE JobStatus = True AND
> WHERE WeekEnding IN tblSuperInput.pmdata = strThursday"
>


No, probably not at all like this. However, we cannot answer this
question. We don't know which table has the WeekEnding field, or what
the datatype of that field is. Also, what table contains the strThursday
field? And is pmdata a table or field?

When asking how to create a query you should provide
1. the schemas for the tables involved in the query. By "schema", I mean
the names and datatypes of the fields involved in the query (if you have
a 50-field table, the quickest way to make us ignore your post is to
provide all 50 field names when you are only using 5 of them in your
query)
2. Some sample data in tabular format
3. The data that the query should retrieve from that sample data - again
in tabular format
4. A short explanation of why the data shown in step 3 should be
retrieved (<grin> and no, "because that's the data I want" will not
suffice)
5. If you've already made an unsuccessful attempt, show the sql you
attempted and show the results you obtained (again, in tabular format),
explaining why the results are incorrect - yes, I know this does not
apply to your current problem

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two dropdownlist and two tables... Paolo ASP .Net Web Controls 0 09-19-2006 04:42 PM
using a datagrid to update two sql tables...I can't get it work TN Bella ASP .Net 1 06-15-2004 02:16 AM
DBI SQL column datatype not jiving with SQL statement requirement dna Perl 1 01-18-2004 04:15 PM
Re: SQL statement working in SQL Server but not in .aspx.cs page William \(Bill\) Vaughn ASP .Net 0 08-21-2003 10:41 PM



Advertisments