Hi all, I need to run a query that performs a count(*) on a table. This gives me the subtotals for each group. Now I need to sumarize the subtotals with sum the results given by the previous count. What would be the best way to do this? Thanks.
|+0 forum 5|
Hi all, There is a (I assume) simple query i cannot figure out (in a best practice way). Let's say I have three tables: [LIST] Users[/LIST] [LIST] AOI (Areas of Interest) [/LIST] [List]Users_AOI (Simply containing userId and AOIId for all interests for each user)[/List] So far so good. Now I want to select all users that have interest of 'x' and 'y' and 'z'. Simple right? How do I do it? My original attempt was [CODE] SELECT Users.Id, Users.FN, etc FROM Users left join Users_AOI on User.ID = Users_AOI.UserId WHERE Users_AOI.AOIID = x and Users_AOI.AOIID = y and Users_AOI.AOIID = …
|+0 forum 15|
Hi All, I have to do a rather simple query, but a previous design error that did not make one of the fields required (it allows nulls when it shouldn't have) makes it a bit harder. I have a table projects and a table clients [B]Projects_Tbl[/B] ProjId ProjName ClientId [B]Clients_Tbl[/B] ClientId ClientName I need to select all projects with client name. The SQL statement should work fine as: [COde=sql]Select * from Projects_Tbl, Clients_Tbl where Projects_Tbl.ClientId = Clients_Tbl.ClientId[/COde] The problem is that it left out all projects with NULL clientId (in Projects_Tbl) Can anyone help? I tried using an "OR" such: …
|+0 forum 4|
Hi there, I have a master detail set of tables with a one-to-many relationship. Let's call the tables Projects (master) and Markets (details). I need to allow users to query the database and be able to select projects by markets. In other words, users should be able to "say": "List all projects where Market is Architecture and Construction" The query is to be created dynamically (this is not the problem here) and there are lots of projects and lots of markets. Can anyone guide me on how to create the query (conceptually). Below is a simplified version of the two …
|+0 forum 7|