473,414 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Problem with Query

44
Hello Friends

Here I have created 3 tables. They are

Table Name: TheatreMaster
-----------------------------------------------------------------------------------------------------
tid tname showtime address phone mobile email
-----------------------------------------------------------------------------------------------------




--------------------------------------------------------------------------------------------------------

Table Name: MovieMaster
--------------------------------------------------------------------------------------------------------
mid moviename actors director producer
--------------------------------------------------------------------------------------------------------



--------------------------------------------------------------------------------------------------------

Table Name: ShowDetails
----------------------------------------------------------------------------------------------------------
sid date tid mid showtime tickettypes status
----------------------------------------------------------------------------------------------------------




-----------------------------------------------------------------------------------------------------------

The dilemma is I want to select the tname (Theatre name) from "TheatreMaster" depending on the moviename on "MovieMaster" via table "ShowDetails".

i.e if I have 2 dropdown list boxes & in the 1st dropdownlistbox (which is populated with the movienames from table MovieMaster) if I select the movie name then the 2nd dropdownlist box should automatically filled with tname(Theatre Names) using the table "ShowDetails". What is the query for this?

-sweatha
Apr 22 '08 #1
3 945
debasisdas
8,127 Expert 4TB
The query is so simple .
What have you tried so far ?

Is there any realtionship between the tables ?
Apr 22 '08 #2
sweatha
44
The query is so simple .
What have you tried so far ?

Is there any realtionship between the tables ?
The relationship is
  • tid is primary key in TheatreMaster Table which is the foreign key in ShowDetails Table
  • sid is primary key in ShowDetails Table
  • mid is primary key in MovieMaster which is the foreign key in ShowDetails

I have tried the query as

"SELECT t.tname FROM theatreMaster t,MovieMaster m,ShowDetails s WHERE m.moviename='" & DropDownList1.SelectedValue & "' and m.mid=s.mid and s.tid=t.tid"

But its not working.
Apr 22 '08 #3
deepuv04
227 Expert 100+
The relationship is
  • tid is primary key in TheatreMaster Table which is the foreign key in ShowDetails Table
  • sid is primary key in ShowDetails Table
  • mid is primary key in MovieMaster which is the foreign key in ShowDetails

I have tried the query as

"SELECT t.tname FROM theatreMaster t,MovieMaster m,ShowDetails s WHERE m.moviename='" & DropDownList1.SelectedValue & "' and m.mid=s.sid and s.tid=t.tid"

But its not working.
here the problem is with the condition 'm.mid = s.sid'

use m.mid = s.mid and will work

"SELECT t.tname FROM theatreMaster t,MovieMaster m,ShowDetails s WHERE m.moviename='" & DropDownList1.SelectedValue & "' and m.mid=s.mid and s.tid=t.tid"
Apr 22 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Brian Oster | last post by:
After applying security patch MS03-031 (Sql server ver 8.00.818) a query that used to execute in under 2 seconds, now takes over 8 Minutes to complete. Any ideas on what the heck might be going...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
20
by: Development - multi.art.studio | last post by:
Hello everyone, i just upgraded my old postgres-database from version 7.1 to 7.4.2. i dumped out my 7.1 database (with pg_dump from 7.1) as an sql-file with copy-commands and to one file using...
0
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue...
3
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.