Showing posts with label addresses. Show all posts
Showing posts with label addresses. Show all posts

Monday, March 19, 2012

How can I list the students in the CIS department? (SQL Server Query)

I need to write the SQL script for the above question.

Student table contains students' IDs, names, Addresses.

MajorMinor table contains 4 departments with unique code.
Name is a field and CIS is an attribute. Code(primary key) is a field and CIS is 13.

Student declares major. Declares table has StudentID and MajorMinorCode. The only student, his StudentID is 3579, has MajorMinorCode 13. (Meaning he is the only student who declared CIS as his major.)

I created and populated my database in SQL Server Management.

I am having trouble if I am selecting 2 tables or just one table with any other clauses?
Any help is appreciated! Thanks!That looks like an assignment / home work .

Can you kindly post what you have tried to solve the mentioned problem.|||

Quote:

Originally Posted by debasisdas

That looks like an assignment / home work .

Can you kindly post what you have tried to solve the mentioned problem.


Here you go.
SELECT Student.Name
FROM (Student INNER JOIN Declares ON Student.ID = Declares.StudentID) INNER JOIN MajorMinor ON Declares.MajorMinorCode = MajorMinor.Code
WHERE ((MajorMinor.Name)="CIS"));

Wednesday, March 7, 2012

How can I hide a textbox using iif field condition...help?

Ok,
I have a set of textboxs on the left (in header) and on the right.
If the data comes accross as this, its ok to show it (notice that
addresses are different):
SOLD TO: SHIPPED TO:
John Doe John Doe
123 This Place 321 That Place
Anywhere, TN 37777 Anywhere, TN 37777
But, if the data comes across as this, its NOT ok to show the SHIPPED
TO (notice that addresses are Same):
SOLD TO: SHIPPED TO:
John Doe John Doe
123 This Place 123 This Place
Anywhere, TN 37777 Anywhere, TN 37777
It is supposed to look like this:
SOLD TO: SHIPPED TO:
John Doe SAME
123 This Place
Anywhere, TN 37777
How can I write an expression to display this way on the visibility
condition?
Is it something like this?:
In the SHIPPED TO name textbox (let's say TextBox1) and SHIPPED TO
address TextBox9 is what constitutes the condition, under visibility
tab:
=IIF(Fields!TextBox2.Value.ToString() = TextBox9.Value,False, True)
////TextBox2 is where the Sold To Address is.
Any help is apprectiated.
Thanks,
Trintthat's the basic idea but what you really are comparing are the
fields!SOLD_TO_ADDRESS.Value = fields!SHIP_TO_ADDRESS.Value not the text box
values themselves, you have to compare the values of the fields in your
dataset. so keep your same construct, just make sure of what you're
comparing.
"trint" wrote:
> Ok,
> I have a set of textboxs on the left (in header) and on the right.
> If the data comes accross as this, its ok to show it (notice that
> addresses are different):
> SOLD TO: SHIPPED TO:
> John Doe John Doe
> 123 This Place 321 That Place
> Anywhere, TN 37777 Anywhere, TN 37777
> But, if the data comes across as this, its NOT ok to show the SHIPPED
> TO (notice that addresses are Same):
> SOLD TO: SHIPPED TO:
> John Doe John Doe
> 123 This Place 123 This Place
> Anywhere, TN 37777 Anywhere, TN 37777
> It is supposed to look like this:
> SOLD TO: SHIPPED TO:
> John Doe SAME
> 123 This Place
> Anywhere, TN 37777
> How can I write an expression to display this way on the visibility
> condition?
> Is it something like this?:
> In the SHIPPED TO name textbox (let's say TextBox1) and SHIPPED TO
> address TextBox9 is what constitutes the condition, under visibility
> tab:
> =IIF(Fields!TextBox2.Value.ToString() = TextBox9.Value,False, True)
> ////TextBox2 is where the Sold To Address is.
> Any help is apprectiated.
> Thanks,
> Trint
>|||Yeah! Now, how do I use this in an iif expression.
Thanks,
Trint|||you'll need to have coditional visibility AND conditional value for your
ship_to text box. I'm assuming you have separate text boxes for each line (
ship_to_name, ship_to_address, ship_to_city_state_zip , same for sold_to text
boxes)
*** VISIBILITY SHIP TO TEXT BOX**
=IIF(Fields!SOLD_TO_ADDRESS.Value = Fields!SHIP_TO_ADDRESS.Value,False, True)
do the same for each text box that may need to be hidden.
you need to conditional format for the ship_to_name to display "SAME" and
not the actual person's name. Use the same type logic.
*** SHIPPED_TO_NAME text box value property
=IIF(Fields!SOLD_TO_ADDRESS.Value = Fields!SHIP_TO_ADDRESS.Value,"SAME",
Fields!SHIPPED_TO_NAME.Value)
"trint" wrote:
> Yeah! Now, how do I use this in an iif expression.
> Thanks,
> Trint
>|||Thank you Mike, I am testing my app...
Trint|||That was it Mike!
Thanks,
Trint