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.
| Author |
Topic |
|
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2010-06-07 : 12:58:06
|
| in this sql I am getting the customers who belong to a particular user. i need to filter out 2 customers from this list, called 'Northern' and 'Norther group' and am not sure how to do this.later I will fix the structure of the db to handle it but this is at a apoint that it needs to go in live now.string sql = "Select * from Users U INNER JOIN UserReports UR ON U.UserName = UR.UserName where UR.ReportCode='R12' AND U.UserName = '" + Request.Params["uname"].Replace("'", "") + "' and Password = '" + Request.Params["pwd"].Replace("'", "") + "'"; DataSet ds = Lib.GetResults(sql, ConnectionHelper.GetSecurityDatabaseConnection()); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count == 1) { Session["UserName"] = Request.Params["uname"].Trim(); Response.Redirect("Default.aspx"); } else { lblMessage.Text = "Invalid UserName/Password."; } |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-06-07 : 13:07:55
|
| the sql part would be AND U.UserName not in ('Northern','Norther Group')JimEveryday I learn something that somebody else already knew |
 |
|
|
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2010-06-07 : 16:49:31
|
| Where would I put that? right before the R12 check? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|