Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query question please

Author  Topic 

John T.
Posting Yak Master

112 Posts

Posted - 2003-10-29 : 16:54:16
Hello and I am like a bad penny that keeps turning up. Been awhile.

For simplicity sake, SelectionsTable has the following columns :

choice1 varchar
choice2 varchar
tot dec

DailyTable :
choice varchar
tot dec

What I would like to do is this. I normally display all the selections to the users from the SelectionsTable. However, it would be nice if I could signify to them which selections have already been made. Perhaps by an * next to that choice. I think I will need some kind of join, but do so little of this db stuff, I am not sure how to do it exactly.
Any help much appreciated
John

John T.
Posting Yak Master

112 Posts

Posted - 2003-10-29 : 16:55:19
I did omit explaining the DailyTable. That is simply where I put selections that they have already made.
Thanks.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-29 : 17:01:50
If you provide DDL for your tables, DML for your sample data, and expected result set using the sample data, you would most likely get an answer. Without that though, your question may go unanswered.

DDL is CREATE TABLE statement
DML would be INSERT INTO statements for sample data

Tara
Go to Top of Page

John T.
Posting Yak Master

112 Posts

Posted - 2003-10-29 : 17:22:58
CREATE TABLE SelectC (IDNum SMALLINT identity(1,1) NOT NULL,
Choice1 VarChar(50),
CO1 DEC(3,1),
Choice2 VarChar(50),
CO2 DEC(3,1),
Tot DEC(3,1),
GT SMALLDATETIME,
PRIMARY KEY (IDNum))

CREATE TABLE DailyTable (IDNum SMALLINT identity(1,1) NOT NULL,
Name VarChar(50),
Selection VarChar(50),
Tot DEC (3,1)
PRIMARY KEY (IDNum))

Sorry about that. I don't need to do an insert. I display the SelectC table to my users. I want to be able to identify the Choice1,Choice2 or Tot in SelectC as having been selected by the user. I would find that out by checking DailyTable for their Name and Selection.

Hope that helps.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-29 : 17:44:34
We need the INSERT though. We need to see the data. We also need to see the expected result set.

Tara
Go to Top of Page

John T.
Posting Yak Master

112 Posts

Posted - 2003-10-30 : 17:03:40
Create Table SelectC (IDNum SmallInt,
Visitor varchar(50),
VO dec(3,1),
Home varchar(50),
HO dec(3,1),
Total dec(4,1),
GTime SmallDateTime,
Primary Key(IDNum))

Create Table Daily (Name varchar(50),
GameNo varchar(50),
Sport varchar(50),
Type varchar(50),
Game varchar(50),
Selection varchar(50),
GTime smalldatetime,
Tot dec(4,1),
VScore smallint,
HScore smallint,
Special smallint,
AbbrvSel varchar(50),
Primary Key (Name,GameNo,Sport, Type))

INSERT INTO [Daily] ([Name, [GameNo], [Game],[Gtime], [Sport], [Type],[Selection],[AbbrvSel],[Tot])
VALUES (@Name, @GameNo,@Game,@GTime,@Sport,@Type,@Selection,@AbbrvSel,@totalvar)

I hope this helps. What I have is this right now. When a user selects from SelectC, any previous selections are not made
known. The program is set up to stop anyone from making a duplicate selection. Problem is, it doesn't identify exactly which
selections have been made.

I would like to do this. When a user selects SelectC, table Daily is checked. If it matches Sport and Type for each Name,
then I would like to have an asterisk by that selection. For example, if Sport and Type match and 'V' is AbbrvSel, I want
the Visitor field to reflect, Visitor*. Remember that they can't make that selection anyway. So nothing gets written to
Daily table with an *.

I hope I made sense. I seldom do these days.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-31 : 11:27:44
You still haven't provided sample data. We need to put data into your tables so that we can play around with it. Sample data is given in the form of INSERT INTO:

INSERT INTO Table1 VALUES('SomeValue', 10, '')
INSERT INTO Table1 VALUES('SomeOtherValue', 20, 'Yes')

We also need to see the expected result set using the sample data.


Tara
Go to Top of Page
   

- Advertisement -