combine SQL SELECT statements into one
От | Neil Stlyz |
---|---|
Тема | combine SQL SELECT statements into one |
Дата | |
Msg-id | 995516.81823.qm@web113717.mail.gq1.yahoo.com обсуждение исходный текст |
Ответы |
Re: combine SQL SELECT statements into one
|
Список | pgsql-novice |
Good Evening, Good Morning Wherever you are whenever you may be reading this.
Please Consider the following information: I have a postgresql table called 'inventory' that includes two fields: 'model' which is a character varying field and 'modified' which is a timestamp field. So the table inventory looks something like this:
Now with the table, fields and data in mind look at the following three queries:
SELECT COUNT(distinct model) FROM inventory WHERE modified >= '2010-02-01';
All three of the above queries work and provide results. However, I want to combine the three into one SQL Statement that hits the database one time. How can I do this in one SQL Statement? Is it possible with sub select?
Here is what result I am looking for from one SELECT statement using the data example from above:
count1 | count2 | count3
Please let me know.
Thanx> :)
|
В списке pgsql-novice по дате отправления: