Hello everyone,
I got the following setup for my database:
Category Table (Fields: CategoryID(PK), Title);
Menu Table (Fields: MenuID(PK) CategoryID(FK), Title);
Page Table (Fields PageID(PK), MenuID(FK), Title, Content, CreatedOn);
Now for one page I want to know how many Pages a particular category holds.
I have no clue how to ma...
I'm developing an ASP.NET/C#/SQL application. I've created a query for a specific grid-view that involves a lot of joins to get the data needed. On the hosted server, the query has randomly started taking up to 20 seconds to process. I'm sure it's partly an overloaded host-server (because sometimes the query takes <1s), but I don't th...
I want to know status of every database across a SQL Server farm. I was using:
select name,
case status
when 32 then 'loading'
when 128 then 'recovering'
when 512 then 'offline'
when 4096 then 'single user'
when 64 then 'pre recovery'
when 256 then 'not recovered'
el...
I have situations that I need to write multiple rows of the same value to setup some tables. Say I have to add 120 rows with two columns populated. I am looking for a shortcut, instead of having the Insert line repeated n times. How to do this?
...
I want to start using Core Date on iPhone with pre-existing MySQL databases. What's the easiest way to transfer a MySQL database to SQLite?
I've tried using SQLite Migrator, but I don't know where to find the ODBC drivers for Mac (Snow Leopard). I found http://www.ch-werner.de/sqliteodbc/ which seems to have drivers, but they are for Po...
In my ERP application, I am taking a extra field named 'IsRemoved' as boolean. Whenever a user deletes any record, the record is not deleted - only its "IsRemoved" column gets value 'true'. It helps us to be able to recover data when ever we want, and its working fine.
The problem is that when ever user deletes record of Master Table, ...
I am trying to figure out how to grab information from my database in the order that I want to. For example, I have the names below in my database:
Matt
Jimmy
Craig
Jenny
Sue
I want to get them out in this order:
Sue
Craig
Jimmy
Matt
Jenny
How would I do that using MYSQL?
...
I'm using SQL Server 2005 and I have a DateTime column.
How can I multiply the hour and minute of a DateTime column by 1.2 and return the new value
So something like:
SELECT
MyColMinute = DATEPART(minute, myCol) * 1.2
MyColHour = DATEPART(second, myCol) * 1.2,
MyCol
From NyTable
Of course the above won't work!
So for example myCo...
SELECT u.user_id, u.first_name, u.last_name, i.path AS image_path
FROM bgy_users u
LEFT JOIN bgy_images i ON i.image_id = u.image_id
WHERE u.commentary_id = '0'
Error:
Unknown column 'u.image_id' in 'on clause'
When there definitely is a column image_id in table bgy_users
What am I doing wrong?
Result for DESCRIBE BGY_USERS
Re...
I am using Mysql NDB Cluster, in my information_schema.Tables tbl I have null entries in the colummn called Create_Time and Update_Time.
Does anyone have any known solution for this.
as on my normal innodb databases the Create_Time and Update_Time is there properly.
...
Using VB.NET and SQL Server 2005
I want to generate a date according to the given Outtime,
Am entering the value like
ID Date Intime Outtime Holiday
001 23-02-2009 08:00:00 17:00:00 no
001 24-02-2009 17:00:00 08:00:00 no
001 25-02-2009 10:00:00 16:00:00 no
001 26-02-2009 18:00:00 20:00:00 no
001 27-02-2009 yes
Ex...
Using SQL Server 2005
I want to generate the table values between the two dates
Table1
ID Date Intime Outtime
01 12-02-2009 10:00:00 17:00:00
02 13-02-2009 08:00:00 16:00:00
03 14-02-2009 09:00:00 21:00:00
04 15-02-2009
Suppose I want to generate the above table values between the two dates.
For Example,
Given Date: start date - ...
Hi all,
In my table table1 there are 6 columns Locations,a,b,c,d,e.
Locations [a] [b] [c] [d] [e]
[1] 10.00 Null Null 20.00 Null
[2] Null 30.00 Null Null Null
i need the result like
Locations [a] [b] [d]
[1] 10.00 Null 20.00
[2] Null 30.00 Null
My question is how to detect and delete colum...
Hi,
Am pretty new to SQL Server 2005. Can someone help me to create a job in SQL Server? This link(http://www.databasedesign-resource.com/sql-server-jobs.html) says to create under the jobs category in managememt tab. But i am not able to find one such category in my SQL Server Management Studio. Is it not possible to create a job using...
Please help me to convert the below statement:
CASE
WHEN TITLE IS NOT NULL THEN 'A'
WHEN LOCAL_TITLE IS NOT NULL THEN 'B'
END
AS COMBINED_TITLE
to something like this:
CASE
WHEN TITLE IS NOT NULL THEN COMBINED_TITLE=TITLE
WHEN LOCAL_TITLE IS NOT NULL THEN COMBINED_TITLE=LOCAL_TITLE
END
AS COMBINED_T...
To discover all triggers in any given MS SQL Server database, I'm currently querying the sysobjects table (which is fine because it works in MS SQL Server 2000 which I have to support) e.g.
SELECT R1.name AS trigger_name,
T1.name AS trigger_parent_table_name
FROM sysobjects AS R1
INNER join sysobjects AS T1
...
Suppose I have 2 fields: first_name and last_name.
It is ok to have first name duplicate, or last name duplicate, but, if both first_name and last_name are the same, do not insert! It's like 2 unique keys, linked.
...
Hi Friends,
I use codeigniter and have an issue about SELECT MAX ... I couldnot find any solution at google search...
it looks like it returns only id :/ it's giving error for other columns of table :/
Appreciate helps, thanks!
Model:
function get_default()
{
$this->db->select_max('id');
$query = $this->db->...
Hy is theere a query where i can do both querys in one?
This is the first
$q = "select c.id as campaignId,c.priceFactor,
o.cid,o.bloggerPrice,o.state as state,o.customerPrice,o.id as orderId,o.listPrice,o.basicPrice
from campaign c, orders o
where c.id={$campaignId}
and c.id = o.c...
I have two or more tables which hold values under the same column name. Now when I join these two tables the column names stay the same. When retrieving these values in PHP ($row['name']) I encounter problems since the column 'name' is used twice.
Are there any possible means of separating these two columns inside the query?
SELECT ...