Update:
I am editing my question in the hope of getting a better answer. I see this is not so simple but I cant believe there is not a simpler solution than what has been mentioned so far.
I am now looking to see if there is some kind of php, mysql solution to deal with this in the most efficent way. I have modified my question below to ...
Hello all,
How would I go about doing the following?
Given the tables, Recipe, RecipeItem, RecipeInstruction. How do I perform a SELECT only if the SELECT statement of Recipe returned results.
If Recipe exists, return RecipeItems and return RecipeInstructions.
...
I have a MySQL table with a structure similar to this:
id1 id2 title url date
I would like to print out a simple table in PHP that with the following structure sorted in reverse chronological order for the most recent 10 entries (date above = date submitted) from the MySQL table:
title id2
How could I do this?
...
I've got a list of synonyms and need to create a database in SQL for it.
I was thinking about using a Relational Database Design, but don't know if it would be the best. There will be a decent amount of traffic using this database.
I was thinking about Table1 would be like
Id
Table2
Id
InterlinkID (Table1 Id)
Word
Would this be th...
In Oracle, if the current user tries to revoke all his permissions, what'll happen?
For example, if I'm a user(John) created with WITH GRANT OPTION - can I revoke my permissions?
...
hi
I want to display 5 records from a database with in a td one after another (about 60sec). How will i do this, with out the need of page refreshing? I don't know any idea about ajax
...
I am new to triggers.
I created a trigger below:
CREATE OR REPLACE TRIGGER ac01_control_trigg
AFTER INSERT ON AC01_CONTROL_TEST
FOR EACH ROW
DECLARE
BEGIN
IF :NEW.cur_pgm_name = 'LSN' AND :NEW.nxt_pgm_name ='MD' AND :NEW.file_status='RD' THEN
UTL_FILE.Fcopy (:NEW.FILE_PATH,:NEW.FILE_NAME,:NEW.FILE_PATH,'CP.txt');
INSERT ...
I write a stored procedure in SQL Server like this
select distinct top 5 videos.videoid,videos.videotitle,videos.videoname,
convert(varchar,videos.posteddate,106) as posteddate,videos.approvedstatus,
videos.videoimage,(ISNULL(videos.views,0.0)) as [views],videos.privacy,
(isnull(videos.rating,0.0)) as rating,videos.userid,
u...
Is there way to do it? I am currently facing problem as one index is being used unnecessarily in my query (as displayed in the execution plan of the query in sql server 2008) and it is degrading the query performance. This index can not be dropped as it is useful for some other query.
...
Hi there:
I have a few SQL Server databases (all in one server), containing their own set of users. Now I'm trying to design a small application that would query those users and then display them in a report (TBD). I've looked over online how to do this, however I didn't find any. Is it possible in SQL Server to retrieve all the users ...
Hi!
Wondering if anyone knows an easy way to do this.
I have a couple of tables with data, this data is "static" in that way that users don't change it, it's only me that gets to insert/update rows.
And I wonder if there's an easy way to insert rows that don't exists and update rows that are different.
The way that I figured would work ...
suppose i have a sequence, called TEST_SEQ
what would be the correct way of selecting its next value ?
this does not work:
select next value for TEST_SEQ
probably because it expects a "FROM" clause.
looking at HSQLDialect.getSequenceNextValString() in hibernate i see this:
"select next value for " + sequenceName + " from dual_" + sequ...
My (simplified) table consist of an
Id int identity(1,1),
File varchar(20),
FileProcessed bit
The logic is this: my application takes first (the order isn't important) record, which has FileProcessed bit set to false. Then it processes the file and sets the FileProcessed bit to true.
Now, it can happen, that the first thread takes a ...
I have a SQL Server function which converts a nvarchar day duration setting into a datetime value.
The day duration format is >days<.>hours<:>minutes<, for instance 1.2:00 for one day and two hours.
The format of the day duration setting can not be changed, and we can be sure that all data is correctly formatted and present.
Giving th...
I have a mix of greek and normal words and now the order of these is that the normal words comes first and then all the greek words. I want them to get mixed in the order so beta in greek is the same as B.
How can I make this ORDER BY in SQL Server?
...
You often see database fields set to have a magnitude of 255 characters, what is the traditional / historic reason why? I assume it's something to do with paging / memory limits, and performance but the distinction between 255 and 256 has always confused me.
varchar(255)
Considering this is a capacity or magnitude, not an indexer, why...
I have a view. one of the view's column contains NVL function (like nvl(col1,col2) colA).
and if i made query on this i will display some records
Ex: select calA from view1;
and if i use the same query as inline view and i use rownum in where clause it displays nothing
Ex: Select * from (select calA from view1) where rownum <10;
I a...
Hello,
for a simple data structure such as so:
ID parentID Text Price
1 Root
2 1 Flowers
3 1 Electro
4 2 Rose 10
5 2 Violet 5
6 4 Red Rose 12
7 3 Television 100
8 3 Radio 70
9 8 ...
I have this query:
select name, body
from news
where body like %MyWord%;
I use MySQL database engine. this query will return name, body when found MyWord in body text.
My problem here is that, when I search about two word in body text, like MyWord1 , MyWord2. or more !!!
How I can do that if you know that this query is calling by...
Hello,
I am designing a system for a client, where he is able to create data forms for various products he sales him self.
The number of fields he will be using will not be more than 600-700 (worst case scenario). As it looks like he will probably be in the range of 400 - 500 (max).
I had 2 methods in mind for creating the database ...