nini's noob sql ^_^

Site backdrop/framework-related discussion & hosted site support

Moderator: Smeagol

User avatar
Posts: 522
Joined: Wed Dec 12, 2001 00:32
Location: Honduras

nini's noob sql ^_^

Postby nobile » Sun Jun 11, 2006 19:41

use pubs

select t.title as libro, p.pub_name as "casa editora", cast(t.price as numeric(12, 2)) as precio
from titles as t
inner join publishers as p on p.pub_id=t.pub_id
where t.type like 'business'
order by t.price desc

select top 5 e.emp_id as "código", e.fname+' '+e.lname as nombre
from employee as e
order by e.hire_date

select datepart(yy, s.ord_date) as "año", datepart(mm, s.ord_date) as mes, sum(s.qty) as cantidad
from sales as s
group by datepart(yy, s.ord_date), datepart(mm, s.ord_date)
order by datepart(yy, s.ord_date)

Noticed that the month numbers are the same as the ones available, so I don't have to select which months xD
Beauty is in the eyes of the beholder <3

Return to “Slowdev”

Who is online

Users browsing this forum: No registered users and 2 guests