This is exactly what I was looking for!!
Thanks Amit....
User Profile
Collapse
-
Hi cozsmin,
There is no problem with ";". semi-colon is taken as statement delimiter.
You have used "BEGIN" in your function. Every BEGIN should have an END clause. Just add an END after your RETURN statement.
Hope this helps.
~/Pradeep...Leave a comment:
-
Hi,
[code=mysql]
Select <some columns>
From service_order A JOIN so_materials B on A.order_number= B.order_number JOIN so_parts C on A.order_number = C.order_number
[/code]
Is this what you were looking for?
~/pradeep...Leave a comment:
-
Hi,
One possible solution for your problem would be: As you have the last update date, you can perform an ORDER BY date DESC and then LIMIT 1.
This will give you only the row which was last updated.
- Pradeep...Leave a comment:
-
Hi amit,
Thanks for your reply.
I agree that the query you posted would give the results, I also know there are other methods to get the same result.
What I wanted to know is how exactly ROWNUM works. If i can say ROWNUM=1, then why doesn't ROWNUM=2 work??
- Pradeep...Leave a comment:
-
Working of ROWNUM in Oracle
Hi All,
I was just going through EMP table in oracle Scott schema.
Say, I want to find out the first employee in alphabetical order who's name starts with 'A'. the following query gives me the desired result:
[code=oracle]
SELECT *
FROM ( SELECT ENAME
FROM EMP
WHERE UPPER(ENAME) LIKE 'A%'
ORDER BY ENAME ASC
)
WHERE ROWNUM=1
[/co... -
-
Hi KaliKraft,
I guess your query should work.
You can also use:
[code=mysql]
SELECT a.empid employee, driving, helping
FROM (SELECT empid,fldTicket ID, sum(driver_hrs) driving FROM emp LEFT OUTER JOIN work on empid=driver GROUP BY empid) a JOIN
(SELECT empid,fldTicket ID, sum(helper_hrs) helping FROM emp LEFT OUTER JOIN work on empid=helper GROUP BY empid) b on a.empid=b.empid...Leave a comment:
-
Hi beary,
I checked it with your table structure - the query works absolutely FINE.
Please try the following:
[code=mysql]
select year, month, day, title, speaker, GROUP_CONCAT(to pic) as TOPICS
from files group by year, month, day, title
order by year, month, day
[/code]
Your topics "money,weal th" will be under TOPICS column.
- Pradeep...Leave a comment:
-
Hi beary,
Please include "date" column in Group By clause and also make sure you have GROUP_CONCAT() function in the Select clause.
For more details on GROUP_CONCAT() please refer:
GROUP_CONCAT
In case of further doubts plz get back.
Thanks,
pradeep...Leave a comment:
-
Hi Jordon,
You can try something like the following:
[code=mysql]
select a.empid employee, driving, helping
from (select empid, sum(driver_hrs) driving from emp left outer join work on empid=driver group by empid) a join
(select empid, sum(helper_hrs) helping from emp left outer join work on empid=helper group by empid) b on a.empid=b.empid
[/code]
plz change the code to match your tables...Leave a comment:
-
Hi,
As per my understanding about your problem, this is what you are looking for:
[code=mysql]
Select title, date, GROUP_CONCAT(to pic)
From <your_table>
Group By title, date
Order By title, date
[/code]
Let me know if you were looking for something else.
-Pradeep...Leave a comment:
-
Hi Moorthyvisu,
Could you please tell us what exactly do you mean by overlap?
In the 3rd case you have mentioned startcode=90 and endcode=100 are overlapped. Meaning??
Anyways, if this data should not be allowed in the table itself then you can create CHECK constraint on the table specifying your rule....Leave a comment:
-
Hi,
If the same account number is repeating then you can use:
1. MAX(account_num ber) in the SELECT clause. As you might know this will result in 1 row.
2. You can also use LIMIT clause.
E.g.:
[code=mysql]
Select account_number
From <Table>
LIMIT 1
[/code]
Even this will result in 1 row
Please let me know if this is what you were looking for.
...Leave a comment:
-
Hi,
In the above query first the SELECT statement is executed and then the result set is inserted in the TABLE1.
So, it is clear that the "table1" should also be included in the Select statement. The query would look something like:
[code=mysql]
insert into table1 (field1)
(select t2.field2
from table2 t2, table1
where t2.field3="stri ng" and t2.field4=table 1.field4)...Leave a comment:
-
-
Hi,
I guess this link might helpful:
http://dev.mysql.com/doc/refman/5.0/...functions.html
Regards,
Pradeep...Leave a comment:
-
Hi Madhumadhi,
Try the following:
[code=mysql]
WHERE product_name = 'CS%142'
[/code]
'%' will match 0 or more characters that can appear between CS and 142. I hope this helps you.
Regards,
Pradeep...Leave a comment:
-
Hi,
You cannot equate any column to NULL. Instead, you need to use the IS operator. If you are looking for rows which have NULL for "app" column then you can use the following:
[code=mysql]
...
WHERE app IS NULL ...
[/code]
I hope this helps you.
Regards,
Pradeep...Leave a comment:
-
Hi,
As far as I know the only way to reset an auto increment column is by truncating the table.
For your problem: You can copy the records from your table to some temporary table, then TRUNCATE your table and load the data back to this table.
Regards,
Pradeep...Leave a comment:
No activity results to display
Show More
Leave a comment: