Forum: MS SQL 25 Days Ago |
| Replies: 11 Views: 821 Why are you creating constants when you can just use the date functions in the where clause?
SELECT sum(Salesamount)
FROM Table
WHERE salesdate BETWEEN ... |
Forum: MS SQL 26 Days Ago |
| Replies: 11 Views: 821 Just replace where I had @userInput with getdate() function
SELECT sum(Salesamount)FROM TableWHERE YEAR(salesdate) = YEAR(getdate())
You can do the same with the date functions example. |
Forum: MS SQL 26 Days Ago |
| Replies: 11 Views: 821 There are alot of ways to do this here are a couple examples.
Using Year() function
Select sum(Salesamount)
From Table
where Year(salesdate) = Year(@userInput) |
Forum: C# 28 Days Ago |
| Replies: 5 Views: 486 You don't directly use triggers in a C# app. If you have a trigger on update for the Student table it will be triggered when you send an update statement from your code. If you want the db to do jobs... |
Forum: MS SQL Oct 19th, 2009 |
| Replies: 2 Views: 516 You can't use the alias in the boolean test plus you should use a having clause to test the count(*) and not the where clause.
Select title, count(*) As Cnt
From poss_titles
Group By title... |
Forum: MySQL Oct 8th, 2009 |
| Replies: 2 Views: 381 Try this
Select a,b,c,d,e,f from
(
(SELECT a, b, c, d, e, f, DATE
FROM table1 WHERE a=10 AND b=1)
UNION
(SELECT a, b, c, d, e, f, DATE
FROM table1 WHERE a=11 AND b=1) |
Forum: MS SQL Sep 29th, 2009 |
| Replies: 3 Views: 474 I beleive you need to use a full outer join with a coelesce on the 3 keys to get your desired result.
SELECT coalesce(a.Recordingid,b.recordingid), coalesce(a.Connection,b.Connection),... |
Forum: C# Sep 25th, 2009 |
| Replies: 6 Views: 351 Use double ampersands && in your if statement. |
Forum: Oracle Sep 23rd, 2009 |
| Replies: 14 Views: 1,932 When you have a higher reputation you get more greeen squares in your header file (I guess it is supposed to signify how competent the responders are) as well I think it might have a reflection on... |
Forum: Oracle Sep 23rd, 2009 |
| Replies: 14 Views: 1,932 By only doing subqueries you basically created a cartesian join. It displayed a record for every possible permutation of the query.
There is a simple explantion of cartesian (cross joins) here.
... |
Forum: Oracle Sep 23rd, 2009 |
| Replies: 14 Views: 1,932 What rownum = 1 is doing is returning only the top row of employee information for each job_id. without the rownum =1 the query will return all matches which is why you get the error message.
... |
Forum: Oracle Sep 22nd, 2009 |
| Replies: 14 Views: 1,932 I know it is possible as I have done similar queries in the past using subqueries. I provided something I put together quickly, not a very good example but it does accomplish what you were inquiring... |
Forum: Oracle Sep 22nd, 2009 |
| Replies: 14 Views: 1,932 I'm not quite sure what you are trying to achieve.
If you just want the job_id then grab it seperately, if you want to see all the employees associated which each job_id you have to return all... |
Forum: Oracle Sep 21st, 2009 |
| Replies: 14 Views: 1,932 Try something like this.
SELECT DISTINCT emp.Job_ID, a.Employee_ID, a.Last_Name
FROM Employees emp
Join (Select job_id,employee_id,Lastname
From Employees)a on emp.Job_id = a.Job_id... |
Forum: MS SQL Aug 29th, 2009 |
| Replies: 2 Views: 478 Did you try using wild cards.
Select * from Table1
Where Name LIKE ('%' + @Name + '%') |
Forum: MySQL Aug 10th, 2009 |
| Replies: 3 Views: 384 Glad I could help. Can you mark the thread solved if your problem has been fixed.
Thanks. |
Forum: MySQL Aug 7th, 2009 |
| Replies: 3 Views: 384 The first thing you need to do is replace the left join with an Inner join. Right now you are joining all the customers even if they do not have any orders which is a waste of resources when you are... |
Forum: MS SQL Aug 5th, 2009 |
| Replies: 4 Views: 380 Have you tried joining the subquery in the from clause instead of using the inline view. |
Forum: MS SQL Aug 5th, 2009 |
| Replies: 4 Views: 380 You should use code blocks as it makes it alot easier to read.
[/code}
Did you try an inline view? something like this maybe
[code=sql]
select |
Forum: Database Design Aug 4th, 2009 |
| Replies: 5 Views: 15,573 At my previous company we also resorted to using dotdefender after we came under a serious sql injection attack. The product worked very well and we were able to get it up and running very fast. It... |
Forum: Database Design Jul 29th, 2009 |
| Replies: 6 Views: 419 Here is a link to an article on creating an event schedule in mysql, unfortunately I don't use mysql so it is the best I can do for you.
... |
Forum: Database Design Jul 28th, 2009 |
| Replies: 6 Views: 419 I don't know mysql very much but if you schedule a job it should not care if a file is open or not. |
Forum: Database Design Jul 28th, 2009 |
| Replies: 6 Views: 419 Schedule a job to run the script at whatever interval you want. |
Forum: Oracle Jul 23rd, 2009 |
| Replies: 6 Views: 476 Mamtha,
If this solved your question can you please mark the thread solved.
thanks. |
Forum: Oracle Jul 23rd, 2009 |
| Replies: 6 Views: 476 Yes intersects work well and are much more readable. |
Forum: Oracle Jul 23rd, 2009 |
| Replies: 6 Views: 476 Try something like this
Select customer from Table
Where purchasedate between trunc(sysdate,'MM') and LAST_DAY (TO_DATE (trunc(sysdate,'MM')))
and product = 'ABC'
INTERSECT
Select customer... |
Forum: Oracle Jul 23rd, 2009 |
| Replies: 6 Views: 476 I think we would need a little more details to what you are asking.
Do you want a list of all customers that purchased a specific product in the current month only IF they had purchased the same... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 596 Try this
SELECT MAKE.MAKE, MAKE.count, color.Color, color.count
FROM(
SELECT MAKE, count(*)count
FROM cars
Group by MAKE
)MAKE,
( SELECT MAKE, color,... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 596 Nevermind, I take it the attachment is the table schema.
Is it important to do it all in one query. What are you using the resultset for because if you do it in one query you will most likely get... |
Forum: MS SQL Jul 21st, 2009 |
| Replies: 7 Views: 332 I actually remember reading both of these threads and had commented on one of them but I still did not correlate them. |
Forum: MS SQL Jul 21st, 2009 |
| Replies: 7 Views: 332 @sknake - thanks, I didn't realize there were multiple threads relating to this db. |
Forum: MS SQL Jul 21st, 2009 |
| Replies: 7 Views: 332 I don't see where you are getting the alias 'c'
Besides that i think you are making it more difficult then it has to be.
select *
from dbo.tblLevelOneApprover a,... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 596 Since you didn't give too much information I thought of a few other interpetations of what you asked.
If field1 is a numeric value you might want the sum of the field grouped by field2
Select... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 596 do you mean something like this
Select field2,count(Field1)
From Table
Group by field2 |
Forum: MS SQL Jul 13th, 2009 |
| Replies: 11 Views: 502 Link82
Group by does exactly that; groups your result set by the fields provided, in the example provided by sknake.
GROUP BY tblManagers.managerID, tblManagers.managerLastName,... |
Forum: MS SQL Jul 8th, 2009 |
| Replies: 7 Views: 570 I can't see any easy way to parse this string in a single select statement. I would try each individual piece at a time and then once you can parse each piece put them back together.
You might... |
Forum: MS SQL Jul 8th, 2009 |
| Replies: 7 Views: 570 You should be able to create a stored procedure and try to break off a piece at a time.
If you don't need the data live maybe you can make a dts package to run daily to parse these strings and... |
Forum: MS SQL Jul 8th, 2009 |
| Replies: 7 Views: 570 I have question.
How were these records imported into the table in the first place?
It would have been easier to parse them correctly when they were initially loaded. |
Forum: MS Access and FileMaker Pro Apr 28th, 2009 |
| Replies: 4 Views: 718 I have never used filemaker but it is a relational db so their is most likely either a sql window or graphic sql designer like in acccess.
If there isn't you will have to find out how to join... |
Forum: MS Access and FileMaker Pro Apr 28th, 2009 |
| Replies: 4 Views: 718 You should have a seperate table which holds your costs and is referenced to the item table.
Items
--------
id ... |