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 |
AegelisX15
Starting Member
1 Post |
Posted - 2014-03-07 : 19:04:45
|
I am still a noob when it comes to SQL. I am using SQL Server Management Studio.I am searching through over a million records and I only need 7 to pop up.- I can use String functions and/or aggregate functions. The only problem is I don't know how to use them.My query below.SELECT OrderID, c.CompanyName, FirstName + ' ' + LastName AS 'Emp Name', s.CompanyName, OrderDateFROM Orders, customers c, Employees, Shippers sWHERE (OrderID > 10999 AND OrderID < 11007) AND Orderdate = 1998ORDER BY OrderIDIf I take the "AND Orderdate = 1998" out then A query shows up but not the one im looking for.Please help me. I have no idea where I am with this. I just hit the SQL WALL. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-03-07 : 19:23:27
|
You didn't add any join conditions. I'm confused why you are asking about aggregate function but didn't include any in your query.Please post some sample data so that we can help.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
maunishq
Yak Posting Veteran
71 Posts |
Posted - 2014-03-10 : 15:50:27
|
tkizer is correct.Please add join conditions. e.g.SELECT OrderID, c.CompanyName, FirstName + ' ' + LastName AS 'Emp Name', s.CompanyName, OrderDateFROM Orders, customers c, Employees, Shippers sON Orders.OrderID = c.OrderIDAND Orders.OrderID = Employees.OrderIDAND Orders.OrderID = s.OrderIDWHERE (OrderID > 10999 AND OrderID < 11007) AND Orderdate = 1998ORDER BY OrderID=======================Not an Expert, Just a learner.!_(M)_! |
|
|
|
|
|
|
|