Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's Wrong With This????
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
What's Wrong With This????
Miscellaneous
Thread ID:
01520346
Message ID:
01520346
Views:
116
The Data:
-- universes
id          campaign_id user_id     query_name
----------- ----------- ----------- ------------------
16          134         2           Another Test
17          134         2           My Test
18          134         2           Some Universe
22          134         2           Kevin's Universe

(4 row(s) affected)

-- universe_xref_voters
id          universe_id voter_id
----------- ----------- -----------
11          16          1945386
12          16          1976110
13          16          1954564

(3 row(s) affected)
and my query
SELECT u.id, u.campaign_id, u.user_id, u.query_name, u.query_desc, v.voter_id
	FROM universes u
	JOIN universe_xref_voters v ON v.universe_id = u.id
	WHERE u.Campaign_Id = 134 
	ORDER BY u.Query_Name
and the results
voter_id    id          campaign_id user_id     query_name
----------- ----------- ----------- ----------- ------------
1945386     16          134         2           Another Test
1976110     16          134         2           Another Test
1954564     16          134         2           Another Test

(3 row(s) affected)
Notice that I'm getting the universes tabel repeated 3 times. I should be getting back all 4 universe roes with a voter Id added on.

My ultimate goal is to get a result set of universes with a count of voters assigned to each, but I can't get past this.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform