Forum > Databases

Firebird: Order by on join.

<< < (3/3)

rvk:
There is nothing wrong (as far as I can see) with the SQL from the original post. And it should sort the way you described.

But I'm starting to believe there is something else wrong. How are you programming the SQL in the TIBQuery? In code or in the Object Inspector? Or both? Maybe you are filling the SQL in the wrong place and there is some override going on. (especially because you say it does work correctly in a SQL editor)

devEric69 already suggested it but it might be best you create a small project where you test your SQL yourself and if it's still giving problems you can post it here (via publish button in the IDE).

iru:
Gentlefolk,
Thanks for the responses. I have to delay further work on this for a couple of days as some ugly weather with strong winds has caused damage to athletics facilities that I look after. off to work I go....
Ian

iru:
Gentlefolk,

I have been rather busy, strong winds around Melbourne last Thursday have caused extensive damage in many areas. There are still thousands of homes without electric power. 

The SQL is loaded in code.

There are two IBQuery:   IBQProgramData and  IBQEventData.
The SQL is written to IBQProgramData as follows:

        BaseDM.DMB.IBQProgramData.SQL.Clear;
        BaseDM.DMB.IBQProgramData.SQL.AddDelimitedText(cEventJoinSQL, '%', True);

Where cEventJoinSQL is a constant
cEventJoinSQL    =  'Select PROGRAM_ID, PROGRAM_EVENT From PROGRAMDATA %' +
                      'inner join EVENTDATA on PROGRAMDATA.Program_ID = EventData.Event_NO %' +
                      'order by EventData.EVENT_NO asc'; 

If I change 'order' to 'xxxorder' there is an ugly SQL error when the transaction on IBQProgramData is started.

Ian

Zvoni:
AddDelimitedText?????
Why the blazes are you using that?
Put the SQL in one line (no LineBreaks) and just use "..blablabla.SQL.Text:=" and be done with it
And remove the '%' from the SQL-String

Navigation

[0] Message Index

[*] Previous page

Go to full version