Search Results

Search found 15 results on 1 pages for 'donator'.

Page 1/1 | 1 

  • SQLAlchemy: select over multiple tables

    - by ahojnnes
    Hi, I wanted to optimize my database query: link_list = select( columns=[link_table.c.rating, link_table.c.url, link_table.c.donations_in], whereclause=and_( not_(link_table.c.id.in_( select( columns=[request_table.c.recipient], whereclause=request_table.c.donator==donator.id ).as_scalar() )), link_table.c.id!=donator.id, ), limit=20, ).execute().fetchall() and tried to merge those two selects in one query: link_list = select( columns=[link_table.c.rating, link_table.c.url, link_table.c.donations_in], whereclause=and_( link_table.c.active==True, link_table.c.id!=donator.id, request_table.c.donator==donator.id, link_table.c.id!=request_table.c.recipient, ), limit=20, order_by=[link_table.c.rating.desc()] ).execute().fetchall() the database-schema looks like: link_table = Table('links', metadata, Column('id', Integer, primary_key=True, autoincrement=True), Column('url', Unicode(250), index=True, unique=True), Column('registration_date', DateTime), Column('donations_in', Integer), Column('active', Boolean), ) request_table = Table('requests', metadata, Column('id', Integer, primary_key=True, autoincrement=True), Column('recipient', Integer, ForeignKey('links.id')), Column('donator', Integer, ForeignKey('links.id')), Column('date', DateTime), ) There are several links (donator) in request_table pointing to one link in the link_table. I want to have links from link_table, which are not yet "requested". But this does not work. Is it actually possible, what I'm trying to do? If so, how would you do that? Thank you very much in advance!

    Read the article

  • Pascal error with array

    - by Donator
    program s;       type info = record                    name, surname: string;                    min, sec: integer;       end;       arrays = array[2..50] of info;       var A: arrays; begin       A[1].name := 'name'; end. What is wrong with that? It gives me range check error and I have no idea what is that.

    Read the article

  • Complicated idea - how to create car racing for my RPG game's players

    - by Donator
    So, I want to create car racing for my RPG game's players. Player can create race and choose how many participants can participate in race. After race is being created, other people can join it. When the maximum participants are collected, race begins. My idea, when the last participant joins, then instantly choose the winner (who's car is the best, that person wins), but how can I do it? If I choose to pick the winner after the last participant joins, then I have to put many queries in one page (select data from table, then delete the race, then select players' cars' statistics and pick the winner and then again, using mysql, send message to everyone). But this idea is really not optimal and it will lag cruelly for that last person. Maybe you have any ideas how I can avoid lag and make it more optimal. Thank you very much.

    Read the article

  • Select and delete selected

    - by Donator
    I am programming something like e-mail for my users. I want to allow people to select letters and delete selected. How can I do it? I can't imagine how can I do it only with one MySQL query. Is it even possible?

    Read the article

  • Pascal - bad number format

    - by Donator
    Program: program s; type info = record name, surname: string; min, sek: integer; end; type arrays = array[1..50] of info; var c, b: text; A: arrays; gr_sk, grup_dal: integer; begin assign(c, 'info.txt'); reset(c); read(c, gr_sk); read(c, grup_dal); id := 1; read(c, A[id].name); read(c, A[id].sek); close(c); end. info.txt file: 3 4 yhgf 4 Please, tell me what is wrong with that. It says that it is bad number format for line 19 I guess.

    Read the article

  • WHERE id IN doesn't work in UPDATE

    - by Donator
    UPDATE statistics' SET money = money + '$money' WHERE member_id IN ((SELECT member_id FROM races WHERE l_id = '$mem_id'), $other_id) What's wrong with that? I want to retrieve all member_ids from races and also include to member_id $other_id. Without $other_id it works. By the way, it gives me "Subquery returns more than 1 row" error.

    Read the article

  • Is it necessary to write ROLLBACK if queries fail?

    - by Donator
    I write mysql_query("SET AUTOCOMMIT=0"); mysql_query("START TRANSACTION"); before I write all queries. Then check if all of them are true and then write: mysql_query("COMMIT"); But if one of query fails, I just pass COMMIT query. So do I really need ROLLBACK function if one of the queries fail? Because without ROLLBACK it also works. Thanks.

    Read the article

  • Php + mysql transactions examples

    - by Donator
    I really haven't found normal example of php file where mysql transactions are being used. Can you show me simple example of that? And one more question. I've already created a lot of programming and didn't use transaction, maybe I can put any php function or smth to header.php that if one mysql_query fails, then others too? Thank you.

    Read the article

1